Solve the problem of slow download dependency when packaging the electric builder

When using Electron builder for packaging, sometimes it gets stuck in downloading for half a day, resulting in packaging failure.

Problem description

Package with Electron builder, sometimes download Electron nsis winCodeSign In the process of timeout, packaging failed (in view of the domestic network conditions).

 • electron-builder   version=22.5.1 os=10.0.18362 • loaded configuration  file=package.json ("build" field) • writing effective config   file=dist\builder-effective-config.yaml • packaging        platform=win32 arch=x64 electron=8.2.3 appOutDir=dist\win-unpacked • default Electron icon is used   reason=application icon is not set • downloading     url= https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z  size=5.6 MB parts=1

It can be seen in the log that the downloading step will download the tool chain according to this, and Timeout is here.

resolvent

  1. Resolve the slow download of Electron
    New Project Root Directory .npmrc File, add the following environment variables:

     ELECTRON_MIRROR= https://npm.taobao.org/mirrors/electron/

    This item sets the Electron image source as Taobao image source.

  2. Solve the slow download of NSIS and winCodeSign
    Draw like a cat, in .npmrc Same settings in ELECTRON_BUILDER_BINARIES_MIRROR Image source address. cnpm also provides the corresponding image source:

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

    In this way, the required tool chain files can be downloaded at a high speed.

the selected readings

When writing this draft article, Taobao ELECTRON_BUILDER_BINARIES_MIRROR The image source is always hung up. If you use it, you will find that NSIS and winCodeSign cannot be pulled down at all.

On April 25, 2020, a brother and I commented on the corresponding issues#1539 Then a big brother fixed the problem.

Therefore, the measure taken at that time was to manually download the file and place it in the Electron builder folder, which is also necessary to know.

  • Nsis storage location
     C:\Users\admin\AppData\Local\electron-builder\Cache\winCodeSign

     electron-builder-nsis

  • WinCodeSign storage location

     C:\Users\admin\AppData\Local\electron-builder\Cache\winCodeSign

     electron-builder-wincodesign

Manually download the files of the corresponding version and unzip them to these two folders.

Zimiao haunting blog (azimiao. com) All rights reserved. Please note the link when reprinting: https://www.azimiao.com/6208.html
Welcome to the Zimiao haunting blog exchange group: three hundred and thirteen million seven hundred and thirty-two thousand

Comment

*

*