I wanted to install npm modules globally and it is not recommended to use sudo
with it:
And this question : npm / yeoman install generator-angular without sudo is the solution to it.
I followed this
echo prefix = ~/.node >> ~/.npmrc
And add this to my .bashrc
file
export PATH=$HOME/.node/bin:$PATH
Now I have to install a global module, for example express-generator
npm install -g yo
But I am still getting an EACCESS
error, and as read the log, it seems like npm is still installing global modules to the /usr/lib/node_modules/
instead of ~/.node/
Error: EACCES, mkdir '/usr/lib/node_modules/express-generator'