Yeoman Generators and permissions on OSX

So here is a tip for OSX users with permission problems when using a Yeoman Generator.

Today, I attempted to install kraken.js…

$ sudo npm install -g yo generator-kraken
$ yo kraken

and I kept running into permission issues.  I had reinstalled multiple versions of node & npm with the same results…

npm ERR! Error: EACCES, mkdir ...
npm ERR! Please try running this command again as root/Administrator.

The real problem here is that I should not have to be logged in as root to run this script. (And also, running under sudo didn’t fix the problem anyway.)

So, if you are having this problem, take a look at your ~/.npm/ directory.  Mine looked like this…

It looked like Yeoman was choking on modifying directories owned by root.  Which of course is good behavior.  What probably happened is I had installed some stuff at some point as root.  Which is of course bad behavior :-/

The fix was straightforward…

cd ~/.npm/
sudo chown gshipon:staff *

Now all is kosher in ~/.npm/

Screen Shot 2014-06-25 at 4.34.04 PM

And kraken.js is happy 🙂

Screen Shot 2014-06-25 at 5.29.38 PM

8 thoughts on “Yeoman Generators and permissions on OSX

  1. Anton says:

    Wow, thanks. A similar problem have been bugging me for quite a while. Really helpful and a solution that works. 🙂 tips hat

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s