When working with npm (Node Package Manager), I picked up the horrible habit of throwing a
sudo in front of
npm install or
npm up. Usually, I only did it when I got an error. This is bad. It becomes a headache at some point. Here’s how to unfuck the permissions of the folder:
- Do this:
sudo chown -R $USER ~/.npm
- And this:
sudo chown -R $USER /usr/local/lib/node_modules
- And, if you get an error, maybe do the
sudo chown -R $USERbit on the folder in question.
chown -R $USER simply changes the ownership to the user recursively to all the stuff in the folder.