3
头图

这两天折腾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.

image.png
这是控制台的报错,然后对应的文件夹确实没有货.看起来就是下载 winCodeSign这个玩意超时了,然后报错了.我想着,我不是开了代理的吗,怎么还报错.于是开始填坑.

PlanA-手动下载

求助搜索引擎后发现,就是因为winCodeSignnsis这两货不能正确的下载到
C:\Users\zhangsan\AppData\Local\electron-builder\Cache该文件夹下面.因此手动进行了下载.参考这里.但是我不想手动下载过来,也怕版本什么的对应不上,白折腾了,于是苦苦搜索,发现了planb.

PlanB-设置.npmrc 自动下载

众所周知,.npmrc可以设置依赖的镜像地址,或者可以链接到你的私欲地址依赖镜像.于是就去淘宝镜像搜索.发现了这个玩意
image.png

好像是关于electron-builderbinaries.就copy过来试试.

  1. 第一步:根目录下创建.npmrc文件.然后copy进去.

    ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
    ELECTRON_BUILDER_BINARIES_MIRROR=http://npm.taobao.org/mirrors/electron-builder-binaries/

    image.png

  2. 试试vue-cli-service electron:build指令
    世界瞬间清静了.再也没有坑爹的超时了.
    image.png
    此时再看看先前的文件夹,是不是有鱼进来
    image.png

Bingo!


路飞的笑
119 声望3 粉丝

人活着就要做有意义的事情。