Use npm -g without password

Written on 03 August 2015

Npm use /usr/lib or /usr/local/bin/, when use npm -g, must use sudo. To use npm without sudo just create new npm global directory

 $ mkdir ./npm-global

Then change locate to new directory

npm config set prefix ~/.npm-global

Add new dir $PATH to .bashrc or .profile

PATH=$PATH:$HOME/.npm-global/bin

Done !

Reading list :
https://docs.npmjs.com/getting-started/fixing-npm-permissions

Read more on nodejs node npm