NPM modules won’t install globally without sudo

Ubuntu 12.04 and using Chris Lea’s PPA for install the following works for me:

npm config set prefix '~/.npm-packages'

and adding $HOME/.npm-packages/bin to $PATH

Append to .bashrc

export PATH="$PATH:$HOME/.npm-packages/bin"

For more see this answer from @passy

Leave a Comment