Electron应用程序仅在构建它的计算机上运行。

huangapple go评论57阅读模式
英文:

Electron app only works on computers where it was builded

问题

I'm trying to create an Electron app for MacOS. To do this, I'm using macOS Catalina on VirtualBox. I can create a DMG file using Electron Builder and Forge. It works fine for me; I can install and run the application. However, it doesn't work on other PCs. People can run the DMG and install it, but they can't run it. They get the error message: "The application app_name can't be opened."

Forge config:

module.exports = {
  packagerConfig: {},
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-dmg',
      config: {
        format: 'ULFO'
      }
    }
  ],
};

Builder config:

"build": {
    "files": [
      "**/*",
      "!node_modules/"
    ],
    "appId": "lib",
    "win": {
      "target": [
        "nsis"
      ]
    },
    "nsis": {
      "oneClick": false,
      "uninstallDisplayName": "Remove Library",
      "shortcutName": "Library",
      "menuCategory": true,
      "allowToChangeInstallationDirectory": true,
      "license": "license.md",
      "language": "0x046D",
      "multiLanguageInstaller": true,
      "unicode": true,
      "installerIcon": "icon.ico",
      "uninstallerIcon": "icon.ico"
    },
    "mac": {
      "target": "dmg",
      "icon": "icon.ico",
      "asarUnpack": "**/*.node",
      "arch": [
        "universal"
      ]
    },
    "extraFiles": [
      {
        "from": "license.md",
        "to": "license.md",
        "filter": [
          "**/*"
        ]
      }
    ],
    "extraResources": [
      "./src/extraResources/**",
      {
        "from": "tor",
        "to": "tor",
        "filter": [
          "**/*"
        ]
      }
    ]
  }
}

It doesn't work even with a simple application that just opens a window.

英文:

I'm trying to create electron app for MacOS. To do this, i'm using macos catalina on virtual box. I can tried dmg file using electron-builder and forge. It works fine for me, i can install and ru application. But it doesn't work on other PC's. People can run dmg and install, but can't run it, "The application app_name can't be opened".
forge config:

module.exports = {
  packagerConfig: {},
  rebuildConfig: {},
  makers: [
    {
  name: '@electron-forge/maker-dmg',
  config: {
    format: 'ULFO'
  }
}
  ],
};

Builder config:

"build": {
    "files": [
      "**/*",
      "!node_modules/"
    ],
    "appId": "lib",
    "win": {
      "target": [
        "nsis"
      ]
    },
    "nsis": {
      "oneClick": false,
      "uninstallDisplayName": "Remove Library",
      "shortcutName": "Library",
      "menuCategory": true,
      "allowToChangeInstallationDirectory": true,
      "license": "license.md",
      "language": "0x046D",
      "multiLanguageInstaller": true,
      "unicode": true,
      "installerIcon": "icon.ico",
      "uninstallerIcon": "icon.ico"
    },
    "mac": {
      "target": "dmg",
      "icon": "icon.ico",
      "asarUnpack": "**/*.node",
      "arch": [
 "universal"
       ]
    },
    "extraFiles": [
      {
        "from": "license.md",
        "to": "license.md",
        "filter": [
          "**/*"
        ]
      }
    ],
    "extraResources": [
      "./src/extraResources/**",
      {
        "from": "tor",
        "to": "tor",
        "filter": [
          "**/*"
        ]
      }
    ]
  }

It doesn't work event with a clear application which just opens window.

答案1

得分: 1

需要对应用程序进行签名,以便能够在其他人的计算机上运行。

英文:

You need to sign the application so it can be able to be run on other peoples machines.

huangapple
  • 本文由 发表于 2023年6月13日 00:20:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76458549.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定