我的package.json配置如下:
{
"name": "im-app",
"version": "1.0.0",
"main": "main.js",
"description": "im-app",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"makeWin":"electron-forge make --arch x64 --platform win32",
"package2": "electron-forge package --arch x64 --platform win32"
},
"author": "xiaoyang",
"license": "MIT",
"config": {
"forge": "./forge.config.js"
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/maker-deb": "^7.5.0",
"@electron-forge/maker-rpm": "^7.5.0",
"@electron-forge/maker-squirrel": "^7.5.0",
"@electron-forge/maker-zip": "^7.5.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.5.0",
"@electron-forge/plugin-fuses": "^7.5.0",
"@electron/fuses": "^1.8.0",
"electron": "^32.1.2",
"electron-packager": "^17.1.2"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.1"
}
}
我的forge.config.js文件如下:
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {
platforms: ['win32']
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};
Mac系统执行npm run package2可以打包出来文件,如下:
打包出来的exe包window无法打开安装
执行npm run makeWin 则报错如下
An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 255
Output:
System.AggregateException: One or more errors occurred
执行npm run make 可以打包出Mac的安装包
备注:打包之前并没有签名
wine-stable和mono相应版本如下
请问有大神可否解答下,我该怎么在Mac系统正确的打包window安装包?
用 electron-packager 或 electron-builder