1. build.js 中的 tasks 重复,这是官方bug
yarn run build
yarn run v1.22.17
$ node .electron-vue/build.js && electron-builder
C:\Users\ruiquan_liu\Desktop\pos-progict\builder\my-project-builder\.electron-vue\build.js:45
const tasks = new Listr(
^
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
error Command failed with exit code 1.
解决办法:删除或者注释.electron-vue/build.js中的 tasks
2. 获取winCodeSign-2.4.0/winCodeSign-2.4.0.7z文件失败,可能是网络原因
OKAY take it away `electron-builder`
• electron-builder version=20.44.4
• loaded configuration file=package.json ("build" field)
• writing effective config file=build\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=2.0.18 appOutDir=build\win-unpacked
⨯ Get https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.4.0/winCodeSign-2.4.0.7z: read tcp 10.8.212.64:62136->20.205.243.166:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:171
github.com/develar/app-builder/pkg/download.(*Downloader).follow
.
.
.
一堆报错输出,就不复制过来了
解决办法:访问https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.5.0/winCodeSign-2.5.0.7z进行下载,下载后放入 C:\Users\你的用户名\AppData\Local\electron\Cache 文件中
说明:
类似的下载问题会有好多,建议访问https://npm.taobao.org/mirrors/electron/地址找到相关包进行下载,报错时会有提示,缺什么下载什么
3. 缺少/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
OKAY take it away `electron-builder`
• electron-builder version=20.44.4
• loaded configuration file=package.json ("build" field)
• writing effective config file=build\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=2.0.18 appOutDir=build\win-unpacked
• downloading parts=1 size=5.6 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.4.0/winCodeSign-2.4.0.7z
• downloaded duration=4m55.176s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.4.0/winCodeSign-2.4.0.7z
• building target=nsis file=build\my-project-builder Setup 0.0.4.exe archs=x64 oneClick=true perMachine=false
⨯ Get https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z: read tcp 10.8.212.64:62243->20.205.243.166:443: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1
/Volumes/data/Documents/app-builder/pkg/download/downloader.go:171
github.com/develar/app-builder/pkg/download.(*Downloader).follow
.
.
.
一堆报错输出,就不复制过来了
解决办法:进入 https://nsis.sourceforge.io/Download 进行下载 下载后放入 C:\Users\你的用户名\AppData\Local\electron\Cache 文件中
结果
OKAY take it away `electron-builder`
• electron-builder version=20.44.4
• loaded configuration file=package.json ("build" field)
• writing effective config file=build\builder-effective-config.yaml
• no native production dependencies
• packaging platform=win32 arch=x64 electron=2.0.18 appOutDir=build\win-unpacked
• building target=nsis file=build\my-project-builder Setup 0.0.4.exe archs=x64 oneClick=true perMachine=false
• downloading parts=1 size=1.4 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
• downloaded duration=1m35.041s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.3.2/nsis-3.0.3.2.7z
• downloading parts=1 size=1.0 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
• downloaded duration=9.42s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.3.0/nsis-resources-3.3.0.7z
• building block map blockMapFile=build\my-project-builder Setup 0.0.4.exe.blockmap
Done in 147.04s.
没有任何报错了,最后看一下我的 C:\Users\你的用户名\AppData\Local\electron\Cache 文件吧 里边我放了很多文件,因为在调研使用中,也没去删除,大家参考使用吧