npm hangs on any command
If anyone will encounter this problem in the future you need to find the npmrc file delete it and delete all configurations for node, delete node as well and install it, this should fix that. when deleting node some of the configurations aren't deleted so you have to delete it manually.
It happenned for me too : I installed node only for my user on Windows 10, and managed to use npm by calling it using the full path "c:\Program Files\nodejs\npm"
I solved by using "c:\Program Files\nodejs\npm" config set prefix "c:\Program Files\nodejs"
(setting the prefix to the full path to npm)
And the result was :
λ cat c:\Users\<my_user_name>\.npmrc
prefix=c:\Program Files\nodejs
Now eveything works fine.
I've finally resolved my issue. According to suggestion from our local read me file
Node.js (with NPM) Note: On windows server machines, instead of node modules been installed at user %APPDATA% path, its better to install at a global path e.g c:\npm. This could be acheived by the npm command: $ npm config set prefix 'c:\npm' This is not required on individual developer's machine.
I've executed npm config set prefix 'c:\npm'
.
As result it added prefix="'c:\\npm'"
to my .npmrc file
This make node.js really crazy. It takes me about an hour to debug all these js scripts npm.js
code.js
etc... to find that it calls mkdirp
with 'c:\\npm'\etc
and it loop process forever.