'Unable to install electron from npm
I am trying to install electron on my ubuntu 16.04, i already have a working nodejs and npm. But suddenly I am unable to install modules by type: sudo npm install electron
Below is the response am getting:
npm WARN registry Unexpected warning for https://registry.npmjs.org/:
Miscellaneous Warning EAI_AGAIN: request to
https://registry.npmjs.org/electron failed, reason: getaddrinfo
EAI_AGAIN registry.npmjs.org:443
npm WARN registry Using stale package data from
https://registry.npmjs.org/ due to a request error during
revalidation.
> [email protected] postinstall
/home/arthur/Documents/Programming/Electron/node_modules/electron
> node install.js
`/home/arthur/Documents/Programming/Electron/node_modules/electron/
install.js:48
throw err ^
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:615:25)
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/arthur/.npm/_logs/2017-12-19T10_25_52_312Z-
debug.log
Solution 1:[1]
The issue is related to proxy configuration. Based on this answer, you can try the following.
First, try to remove if there exists your initial config:
npm config rm proxy
npm config rm https-proxy
And optionally if needed, try to set your proxy config
npm config set proxy proxy-url
npm config set https-proxy proxy-url
Solution 2:[2]
I tried everything but it seems I was using CENTOS which allowing me to install electron. I got help from FlashJonas: and tried installing electron again and it was installed as expected.
sudo npm install electron -g --verbose --unsafe-perm=true
Solution 3:[3]
Removing the proxy and https-proxy worked for me, just in case there is another person with a similar situation. just enter the following in your terminal:
npm config rm proxy
npm config rm https-proxy
Solution 4:[4]
Do Any of the following. It Work for me.
- Change Internet Connection.
- Delete all electron file and then install npm insatll electron.
- Try to install old version of electron.
This Error is because it can't able to download "electron-v11.2.1-win32-x64.zip" file. So Change Internet Connection it work for me.
Solution 5:[5]
I am behind a corporate proxy and had similar issues. None of the options above helped. In the end, I followed the instructions below to reconstruct the electron cache manually, so that it will not have to hit the network to download the binaries:
https://www.electronjs.org/docs/v14-x-y/tutorial/installation#custom-mirrors-and-caches
Basically I used a personal laptop (i.e. not behind the proxy) to install the latest electron on some test app, and then copied the %LOCALAPPDATA%\electron\Cache folder from my personal to the corporate laptop. Everything worked fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Suraj Rao |
| Solution 3 | ArthurKay |
| Solution 4 | Pranay |
| Solution 5 | AsGoodAsItGets |
