electron-builder 制作安装程序
package.json
{
"name": "",
"version": "1.0.0",
"description": "",
"author": "",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder",
"build-win32": "electron-builder --ia32",
"build-win64": "electron-builder --x64"
},
"repository": "",
"keywords": [],
"license": "",
"devDependencies": {
"electron": "^17.0.1",
"electron-builder": "^22.14.13"
},
"build": {
"productName": "",
"appId": "",
"copyright": "",
"compression": "maximum",
"directories": {
"output": "build"
},
"asar": false,
"win": {
"icon": "logo/256.ico",
"artifactName": "${productName}_setup_${version}.${ext}"
},
"mac": {
"icon": "logo/512.png",
"artifactName": "${productName}_setup_${version}.${ext}"
},
"linux": {
"icon": "logo/256.ico",
"artifactName": "${productName}_setup_${version}.${ext}"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "logo/256.ico",
"uninstallerIcon": "logo/256.ico",
"installerHeaderIcon": "logo/256.ico",
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": ""
}
}
}
打包程序
npm run build
# 以管理员权限运行,避免权限不足报错