Thursday, May 12, 2016

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

If you are wondering what I'm up to these days by setting up Node, npm in a Mac. Well I'm preparing my Mac for SharePoint development. Specifically Apps using client side libraries and scripts.

I'm trying to install Yeoman through the terminal application in Mac and ended up getting the below error.

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Though I use Mac, I'm a hardcore Windows user and do my development in Windows and mainly Microsoft technologies. So this error is new to me. Read quite a few blogs to find the correct method to resolve the issue and below is my finding.

Its a permissions issue in the home directory. I need to reclaim the ownership of the npm directory.

sudo chown -R ReplaceWithUserName ~/.npm

Also I need the write permission in to node_modules directory:
sudo chown -R ReplaceWithUserName /usr/local/lib/node_modules

This sorted my issue installing Yeoman.

No comments: