Missing write access in mac to /usr/local/lib/node_modules

I had this issue, I could fixed it by calling sudo on every global install. I wasn't ok with that.

I followed the n package installation advices to be able to install npm packages without sudo.

sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

Answer of @jeduard didn't work for me.


Run these commands in a terminal window:

sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules