npm ERR! Error: connect ECONNREFUSED

Try:

npm config set proxy null
npm config set https-proxy null
npm config set registry http://registry.npmjs.org/

The first two lines will remove proxy's if there any.

Third line will make npm download from the official package registry.


If you are behind a proxy, please make sure that the npm ERR! 'proxy' config is set properly. See: 'npm help config'

See:

  • https://docs.npmjs.com/cli/config

More info:

  • How to setup Node.js and Npm behind a corporate web proxy

I got a similar error when I was using Node JS behind a proxy server. Here's what I had to do to fix it:

npm config set proxy http://jdoe:[email protected]:8080
npm config set https-proxy http://jdoe:[email protected]:8080

Just replace "jdoe" and "password123" with your own credentials to access the proxy server. Everything after the @ is the server domain name, or you can enter the exact IP address too. In my case, both addresses were HTTP (not HTTPS).

To confirm the changes, you can type:

npm config list

and your settings should be listed.

You can get the proxy settings (address) from your browser too.