Why is Electron download slow or even stuck?
When download of the dependency package starts, it may be very slow, and a timeout error of npm even occurs after I wait for a long time.
Solution A
If you work from an office in your company, you need to check whether the proxy configuration of npm points to the proxy server of your company and whether the ELECTRON_GET_USE_PROXY
environment variable is configured, and if not, perform the following steps:
1. Set the npm proxy: npm config set all_proxy=[your proxy address].
2. Configure the ELECTRON_GET_USE_PROXY
environment variable, so that the Electron installation script will be downloaded through the npm proxy.
Solution B
If you use macOS, run the following command:
$ export ELECTRON_GET_USE_PROXY=true
Solution C
If you use Windows:
1. Right-click PC > System Properties> Advanced > Environment Variables.
2. Set the environment variable ELECTRON_GET_USE_PROXY
as shown below and run npm install
or npm install --proxy=[your proxy address]
:
Was this page helpful?