npm install hangs

Solution 1:

I had the same problem. The reason - wrong proxy was configured and because of that npm was unable to download packages.

So your best bet is to the see the output of

$ npm install --verbose

and identify the problem. If you have never configured proxy, then possible causes can be

  • Very outdated npm version.
  • Some problem with your internet connection.
  • Permissions are not sufficient for npm to modify files.

Solution 2:

I was having the same problem. I tried a

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

to turn off https. I also tried

npm set progress=false 

to turn off the progress bar (it has been reported to slow down downloads).

The problem was with my network driver. I just needed to reboot and the lag went away.

Solution 3:

You can try deleting package-lock.json and running npm install afterwards. This worked for me.

Solution 4:

I had the same issue on macOS, after some time struggling and searching around, this answer actually solved the issue for me:

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