Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM does not install anything : it hangs

Tags:

Whenever I want to install a module with NPM, it hangs at that stage:

npm install express npm http GET https://registry.npmjs.org/express 

And that's it. It has that behavior for anything I input instead of express. I installed nodejs and nvm that way (Ubuntu 13.10):

sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs 

I tried looking on the Internet and GitHub and I found a closed issue about npm hanging forever when trying to install a module.. but it was a really old issue. Before I ask the developers, am I missing something obvious ?

I tried compiling both nodejs and npm but the result was the same.

EDIT: npm install express -verbose -> http://pastebin.com/tGY3V6Ly Error:

npm info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=140072708810560:error:140770FC:SSL   routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:766: 
like image 902
Videl Avatar asked Nov 18 '13 11:11

Videl


People also ask

Why 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 my 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).

How do I force an NPM package to install?

The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk. The -g or --global argument will cause npm to install the package globally rather than locally.


2 Answers

NPM has been having server issues of late. Try running the command with -verbose to check and see what is going on, and be patient.

like image 196
Munim Avatar answered Oct 29 '22 10:10

Munim


I had this issue on a BeagleBone Black (low power ARM device) and running npm cache clean seemed to get things moving again.

like image 32
Eric Rini Avatar answered Oct 29 '22 11:10

Eric Rini