mac用electron-forge打包exe包

首先package.json,scripts里面要新增

--arch x64代表64位,
--platform win32 代表windows包

"package2": "electron-forge package --arch x64 --platform win32",
"make2": "electron-forge make --arch x64 --platform win32",
    "scripts": {
      "start": "electron-forge start",
      "package": "electron-forge package",
      "package2": "electron-forge package --arch x64 --platform win32",
      "make": "electron-forge make",
      "make2": "electron-forge make --arch x64 --platform win32",
      "publish": "electron-forge publish",
      "lint": "echo \"No linting configured\""
    },


报错

    An unhandled rejection has occurred inside Forge:
Error: Wrapper command 'wine64' not found on the system. Run `brew install --cask wine-stable` to install 64-bit wine on macOS via Homebrew.

Wine is required to use the appCopyright, appVersion, buildVersion, icon, and 
win32metadata parameters for Windows targets.

See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for details.

Electron Forge was terminated. Location:

原因是mac没有windows环境,需要运行brew install --cask wine-stable安装一下

结果brew版本太低,外网不稳定,又升不上去

后来又找了个国内镜像
直接运行,按照中文提示操作,可以直接升级brew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed

最后打包成功!

你可能感兴趣的:(electron)