报错截图:
图标未显示截图:
修改代码:
//package.json文件
"build": {
"productName": "myProject",
"appId": "123456789",
"asar": true,
"directories": {
"output": "release"
},
"files": [
"icons/*",
"electron/**",
"dist/**",
"!node_modules/"
],
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"installerIcon": "icons/18TP256.ico",
"uninstallerIcon": "icons/18TP256.ico",
"installerHeaderIcon": "icons/18TP256.ico"
},
"win": {
"icon": "icons/18TP256.ico",
"target": [
"nsis"
]
}
},
根目录创建icons文件夹并有一张ico图标
electron的主线程main文件里面添加图标
这样图标就出来了
图一截图,打包卡在building,打包不成功问题修改参照网址:
https://blog.csdn.net/weixin_42987525/article/details/137994881
解决内容:
1、手动下载文件
复制上面提示的url链接:https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z
2、解压下载的文件包
解压后把文件夹winCodeSign-2.6.0放到C:\Users\用户名\AppData\Local\electron-builder\Cache\winCodeSign文件夹下面,如果Cache目录下面没有winCodeSign文件夹,需要手动创建
问题:
还会遇到这个文件下载不下情况
Get “https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z”
解决:
1、手动下载文件
复制上面提示的url链接:https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z
2、解压下载的文件包
解压后把文件夹nsis-3.0.4.1放到C:\Users\用户名\AppData\Local\electron-builder\Cache\nsis文件夹下面,如果Cache目录下面没有nsis文件夹,需要手动创建