npm ERR! Error: connect ECONNREFUSED

NickJS picture NickJS · Feb 21, 2017 · Viewed 60.8k times · Source

I'm trying to update the npm (node package manager) using the command: npm install npm@latest -g but I', getting the following error in the command prompt:

does someone know what this really means?

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "npm@latest" "-g"

npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect

npm ERR! Error: connect ECONNREFUSED xxx.xxx.xx.xxx:xxx
npm ERR!     at Object.exports._errnoException (util.js:1022:11)
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'

any help would be appreciated.

Thank you nickJS

Answer

Ridd picture Ridd · Aug 25, 2017

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.