electron 由于Apple Silicon设备不支持“openfolder”,电子伪造制作失败

c9qzyr3d  于 8个月前  发布在  Electron
关注(0)|答案(1)|浏览(80)

我使用的MacBook Air M2(索诺马14.0)与电子版本27.0.3
我试图运行electron-forge make为Electron应用程序制作可分发文件。但在启动命令时,我得到以下错误:

✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: zip, dmg
✔ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
      ✔ [plugin-webpack] Preparing native dependencies
      ✔ [plugin-webpack] Building webpack bundles
  ✔ Packaging application
    ✔ Packaging for x64 on darwin [3s]
  ✔ Running postPackage hook
✔ Running preMake hook
❯ Making distributables
  ✔ Making a zip distributable for darwin/x64 [11s]
  ✖ Making a dmg distributable for darwin/x64
    › Command failed: bless --folder /Volumes/ApplicationName --openfolder /Volumes/ApplicationName
      bless: The 'openfolder' is not supported on Apple Silicon devices.
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: Command failed: bless --folder /Volumes/ApplicationName --openfolder /Volumes/ApplicationName
bless: The 'openfolder' is not supported on Apple Silicon devices.
at makeError (/Users/elerua/Code/CE-mainrepo/Frontend/node_modules/appdmg/node_modules/execa/index.js:174:9)
    at /Users/elerua/Code/CE-mainrepo/Frontend/node_modules/appdmg/node_modules/execa/index.js:278:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

字符串
我根据文档在package.json文件中添加了多个maker:

"makers": [
    {
        "name": "@electron-forge/maker-squirrel",
        "config": {
            "name": APPLICATION_NAME,
            "setupIcon": APPLICATION_ICON
        }
    },
    {
        "name": "@electron-forge/maker-zip",
        "config": {
            "name": APPLICATION_NAME
        },
        "platforms": [
            "darwin"
        ]
    },
    {
        "name": "@electron-forge/maker-dmg",
        "config": {
            "name": APPLICATION_NAME,
            "setupIcon": APPLICATION_ICON,
            "format": "ULFO"
        }
    },
    {
        "name": "@electron-forge/maker-deb",
        "config": {
            "name": APPLICATION_NAME,
            "setupIcon": APPLICATION_ICON
        }
    },
    {
        "name": "@electron-forge/maker-rpm",
        "config": {
            "name": APPLICATION_NAME,
            "setupIcon": APPLICATION_ICON
        }
    }
]


我一直在互联网上搜索多种方法来解决这个问题,但找不到任何帮助。

jqjz2hbq

jqjz2hbq1#

我终于找到了无法通过帖子看到的解决方案。我电脑上使用的默认Node.js是为x64而不是arm64构建的v18.X.X。一旦安装了正确的Node.js版本,我就可以追求electron-forge make了。

提示

node -v || node --version # check version
nvm ls # list locally installed versions of node
nvm install 20.7.0 # install specific version of node
nvm alias default [NODE_VERSION_YOU_WANT_TO_USE] # set default version of node
nvm use [NODE_VERSION_YOU_WANT_TO_USE] # switch version of node
nvm install --lts # install latest LTS version of node (Long Term Support)
nvm install stable # install latest stable version of node

字符串

相关问题