Node.js : NPM Install Fails

I screwed up the permissions on my npm installation, and had this error when reinstalling. I solved it in the crudest way: by liberally sudo rm -rfing any directory tree that gave me trouble, then recompiling node.js and reinstalling npm.

If all else fails, you could fall back to that.


Why are you running that in /usr?

If you really need to, this page suggests you may run that as root, so that would be:

curl https://www.npmjs.com/install.sh | sudo sh

But you better make sure it won't break your system, before running that.