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 -rf
ing any directory tree that gave me trouble, then recompiling node.js and reinstalling npm.
If all else fails, you could fall back to that.