NPM does not install any modules: network connector hangs
Salam (means Hello) :)
I have the latest node.js installed, installed on ubuntu 12.04, I am not behind proxies, and my network settings are correct and intact since NPM was working fine. But now NPM pauses the installation of any modules with the following error:
nasser@nasser-desktop:~/projects/server v3$ npm install simple-proxy
npm WARN package.json docco@0.6.2 No repository field.
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm http GET https://registry.npmjs.org/simple-proxy
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Linux 3.5.0-17-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "simple-proxy"
npm ERR! cwd /home/nasser/projects/serverV3
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! code ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/nasser/projects/serverV3/npm-debug.log
npm ERR! not ok code 0
source to share
I had a similar problem with my windows machine and I fixed it by first checking if my proxy got any value by running the command below.
npm config get proxy
In response, I got the following:
http://usr:pwd@host/:port
So, if someone who is not under the proxy layer first set the proxy to null by running the following command.
npm config set proxy null
now if you have outdone your npm i it shouldn't throw a network error.
source to share
If you are behind a proxy that has username and password authentication, try setting the proxy as
npm config set proxy http: // username: encodedpassword @ proxyaddress : port
npm config set https-proxy http: // username: encodedpassword @ proxyaddress : port
source to share