node.js - npm not working - "read ECONNRESET"

ID : 20221

viewed : 3

Tags : node.jsnpmnode.js

Top 5 Answer for node.js - npm not working - "read ECONNRESET"

vote vote

95

use

npm config set registry http://registry.npmjs.org/ 

so that npm requests for http url instead of https.

and then try the same npm install command

vote vote

87

You may want to check your NPM proxy settings and perhaps remove it.

npm config get proxy npm config rm proxy npm config rm https-proxy 

One might expect a fresh install of NodeJS+NPM would not have a proxy configured. Strangely enough, mine did come with a proxy defined, pointing to an IP and port 3128. Removing the proxy did the trick.

vote vote

80

You may also need to specify the proxy server/port, in some environments the system settings for proxy are not enough for npm to work.

    npm config set proxy "http://your-proxy.com:80" 
vote vote

61

Remove your proxy settings at home and switch on at Office networks, This may be irritating, But It worked for me:

npm config set proxy http://xxx.xxx.xxx.4:8080    npm config set https-proxy http://xxx.xxx.xxx.4:8080 

and

npm config rm proxy    npm config rm https-proxy 
vote vote

51

This can be caused by installing anything with npm using sudo -- this causes the files in the cache to be owned by root, resulting in this problem. You can fix it by running:

sudo rm -rf ~/.npm

to remove the cache. Then try whatever you were doing again, making sure you never use sudo along with npm (or the problem may come back).

Lots more information: npm throws error without sudo

Top 3 video Explaining node.js - npm not working - "read ECONNRESET"

Related QUESTION?