问题
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.
> electron@1.7.10 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 y@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.10 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.7.10 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
回答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
回答2:
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
回答3:
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
来源:https://stackoverflow.com/questions/47885108/unable-to-install-electron-from-npm