This is a pretty common issue where you try to runnpm install
or npm install -g
and you get this error saying:
npm ERR! Error: EACCES: permission denied
npm ERR! Please try running this command again as root/Administrator.
Well, this is pretty annoying. But there is a simple way to fix this, on Ubuntu and it should theoretically work on any other Linux/*nix system including OS X. Do comment if it doesn’t work for you.
sudo chown -R $(whoami) ~/.npm
The above code should fix the issue. Make sure the directory you’re working in also belongs to $(whoami)
– which pretty much gets replaced by your current username – ubuntu
on my server. The -R
flag means to do it recursively.
I’ve just confirmed that this works on OS X as well, have fun!
The post NPM permission issues when not running as root/admin appeared first on a Melbourne Magento Developer.