这两天折腾 electron-builder
; 的确的被虐了. 文档看的云里雾里的, 只能靠 google.
上面进入主题.
超时问题
• electron-builder version=22.9.1 os=10.0.19042
• description is missed in the package.json appPackageFile=G:\_personal\lasa-project-client\dist_electron\bundled\package.json
• author is missed in the package.json appPackageFile=G:\_personal\lasa-project-client\dist_electron\bundled\package.json
• writing effective config file=dist_electron\builder-effective-config.yaml
• rebuilding native dependencies dependencies=sqlite3@5.0.0 platform=win32 arch=x64
• rebuilding native dependency name=sqlite3 version=5.0.0
• packaging platform=win32 arch=x64 electron=9.3.3 appOutDir=dist_electron\win-unpacked
• default Electron icon is used reason=application icon is not set
⨯ Get "https://github-releases.githubusercontent.com/65527128/f73f2200-5d53-11ea-8264-ddd345f11ee4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210716%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210716T015308Z&X-Amz-Expires=300&X-Amz-Signature=d1a508b2e0e7ed18229f10842c8a3cc105b83307d3e6750b81622f0713a91dab&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=65527128&response-content-disposition=attachment%3B%20filename%3DwinCodeSign-2.6.0.7z&response-content-type=application%2Foctet-stream": read tcp 172.17.7.151:64211->185.199.111.154:443: wsarecv: An existing connection was forcibly closed by the remote host.
这是控制台的报错, 而后对应的文件夹的确没有货. 看起来就是下载 winCodeSign
这个玩意超时了, 而后报错了. 我想着, 我不是开了代理的吗, 怎么还报错. 于是开始填坑.
PlanA- 手动下载
求助搜索引擎后发现, 就是因为 winCodeSign
和nsis
这两货不能正确的下载到 C:\Users\zhangsan\AppData\Local\electron-builder\Cache
该文件夹上面. 因而手动进行了下载. 参考这里. 然而我不想手动下载过去, 也怕版本什么的对应不上, 白折腾了, 于是苦苦搜寻, 发现了 planb.
PlanB- 设置.npmrc 主动下载
家喻户晓,.npmrc
能够设置依赖的镜像地址, 或者能够链接到你的私欲地址依赖镜像. 于是就去淘宝镜像搜寻. 发现了这个玩意
如同是对于 electron-builder
的binaries
. 就 copy
过去试试.
-
第一步: 根目录下创立
.npmrc
文件. 而后 copy 进去.ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ ELECTRON_BUILDER_BINARIES_MIRROR=http://npm.taobao.org/mirrors/electron-builder-binaries/
- 试试
vue-cli-service electron:build
指令
世界霎时清静了. 再也没有坑爹的超时了.
此时再看看先前的文件夹, 是不是有鱼进来
Bingo!