Permission Fix For Node JS


I ran into the following problem when installing Yeoman:

It turns out the problem was a permissions error with my node_modules directory. The following command fixed it:

sudo chown -R `whoami` /usr/local/lib/node_modules

If you think this may be the problem you can check the ownership of your directories with:

ls -l ~/.npm and ls -l /usr/local/lib/node_modules

Privileges Owner Group
drwxr-xr-x 4 matthew staff 136 24 Apr 21:56 abbrev/

Check that owner of the files match the whoami command. In this case, it is indeed me. But if it isn’t you then above command will fix your node_modules directory permissions and sudo chown -R `whoami` ~/.npm