Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM doesn't install any modules: network socket hangs up

Salam (means Hello) :)

I have the latest version of node.js installed on ubuntu 12.04, I'm not behind any proxies, and my network settings are correctly configured, and were intact since last time when NPM worked fine. But now NPM hangs up installation of any modules with following error:

nasser@nasser-desktop:~/projects/server v3$ npm install simple-proxy
npm WARN package.json [email protected] 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
like image 307
Nasser Torabzade Avatar asked Dec 05 '13 10:12

Nasser Torabzade


People also ask

What to do if npm install hangs?

To solve the issue, try removing the entire node_modules/ folder and the package-lock. json file. Then try running the npm install command again. That may fix the issue.

Why npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).


Video Answer


2 Answers

i had same problem. it seems that there is some problem with ISP's https handling. doing:

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

worked for me

like image 154
pajooh Avatar answered Oct 19 '22 06:10

pajooh


I was having the same problem. Found a solution in this thread. You can see the effective proxy that npm is using by doing:

npm config get proxy
npm config get https-proxy

If you're behinid a proxy, try this:

mv ~/.npmrc ~/.npmrc.bak
like image 27
Marina Avatar answered Oct 19 '22 06:10

Marina