I was trying to install a package today and npm just kept spinning and never finished. It is usually slow at work, but not this bad. I ran it with --verbose and got a line like the following:
> npm isntall -g gulp --verbose
npm verb addRemoteTarball 'xxxx'
And then it wouldn’t continue.
I had two paths set in my TMP variable on Windows. You can check your full npm config with npm config ls -l, but here is the line that was giving me trouble:
> npm config get tmp
C:\Users\gkent\AppData\Local\Temp;C:\ffmpeg\bin
Note the second path of C:\\ffmpeg\\bin separated by a ;.
You can add the real TMP location to your user config:
> npm config set tmp %USERPROFILE%\AppData\Local\Temp
To apply it globally, run the command with a -g flag at the end.
You can also set TMP dir on each npm command like so:
> npm install --tmp %USERPROFILE%\AppData\Local\Temp -g gulp
This is fine temporarily, but annoying to remember to do.
Change your TMP path to only have 1 location like so:
TMP environment variable and select it.;cmd prompt or program you are using to access npmNow you can install packages like normal, but just remember to set the path of TMP back if you need it for a program like I do.