首先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
【mac用electron-forge打包exe包】最后打包成功!
推荐阅读
- Electron进程通信
- 番外篇客户端开发(Electron)无源码如何做汉化
- 客户端开发(Electron)加入Vue2.6
- 融云 IM 在 Electron 平台上的设计实践
- 使用 VSCode 调试 Electron 主进程代码
- #yyds干货盘点# Electron常见问题 48 - Electron 获取本机 MAC 地址
- 如何防止Electron app中断macOS系统关机()
- 如何为Electron / Atom Shell App设置应用程序图标
- Spectron,mocha和chai可以声称变量在Electron-app中具有预期值吗()