0

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'
Community
  • 1
  • 1
Joey Hipolito
  • 3,108
  • 11
  • 44
  • 83
  • nvm might be an easier alternative, and installs to your home directory: https://github.com/creationix/nvm – dylants Jul 01 '14 at 18:50

2 Answers2

0

Maybe you just should start a new terminal session or run 'source ~/.bashrc'?

tibalt
  • 15,201
  • 1
  • 29
  • 22
0

You are not running it as sudo, run this instead

sudo npm install -g express
grepit
  • 21,260
  • 6
  • 105
  • 81