Unable to install electron from npm

风流意气都作罢 提交于 2019-12-24 09:06:16

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!