Recently, I have been using the electronic-packager to pack the electron. Every time I go to the electronic-packager step, I always get stuck. Online said set ELECTRON_MIRROR to https://npm.taobao.org/mirrors/electron/, you can set after or slow, can’t, can only look at the source code, see what did the installation process, is omitted the N word… In the installation process, the electron packager will download electron according to the platform and version of electron you want to compile. The default download source is Github, but ELECTRON_MIRROR can be used to modify the download. The ELECTRON_CUSTOM_DIR is set again because alibaba is named differently from Github (see link below).

Electron installation code using electron/get this library, path three of three parts, the mirror/nightly_mirror | customDir | customFilename

https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|                                                     |       |                           |
-------------------------------------------------------       -----------------------------
                        |                                                   |
              mirror / nightly_mirror                  |    |         customFilename
                                                       ------
                                                         ||
                                                      customDir
Copy the code

Take a look at the difference between default path and Ali source path

V6.0.9 https://github.com/electron/electron/releases/download/ * * * * / electron - v6.0.9 - win32 - x64. Zip 6.0.9 https://npm.taobao.org/mirrors/electron/ * * * * / electron - v6.0.9 - win32 - x64. ZipCopy the code

The three parts have corresponding environment variables that can be modified: ELECTRON_MIRROR,ELECTRON_CUSTOM_DIR, and ELECTRON_CUSTOM_FILENAME. After comparing the two links, it is found that the names of the two sources of customDir are different, so the Settings are as follows

export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/
exportELECTRON_CUSTOM_DIR = 6.0.9Copy the code

The value of ELECTRON_CUSTOM_DIR is set according to the version you are using. If you are using 6.0.10, set it to

exportELECTRON_CUSTOM_DIR = 6.0.10Copy the code

How, after setting up, installation is not gray fast ah, [smile.gif]

If you are compiling Win32 under Linux, you need to install Windows to use it. I am using Ubuntu, and the installation command is as follows

Win32 64

apt-get update && apt-get install wine -y

Win32 32-bit

dpkg --add-architecture i386 && apt-get update && apt-get install wine32 -y