-4

I've installed the latest version of Node.js and it works fine when I try to get the version in CMD but when I write npm install or any other installation command it gives error.

enter image description here

Grisha Levit
  • 8,194
  • 2
  • 38
  • 53

1 Answers1

0

That's a connection issue. Ensure you have internet access and that your not behind a proxy that could be blocking npm.

Options to Resolve

1. SSL issue.

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

So that npm looks for the http version, rather then the https site. You should then be able to use npm install as normal

2. Proxy Issue

Check your npm proxy settings, and consider removing it. Run:

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

3. Sudo Issue

(answer by Kevin Cooper)

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

4. Actual NPM Issue

This is the least likley, but it is worth checking there are no open issues relating to this at the moment.

This issue resulted in a similar problem to you had: https://github.com/npm/npm/issues/9418

Finally, since this is quite a common error message, take a look at other StackOverflow and web results. This one especially may help, Node js ECONNRESET

Community
  • 1
  • 1
Alicia Sykes
  • 5,997
  • 7
  • 36
  • 64