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 any folder:
- Do this:
sudo chown -R $USER ~/.npm(you’ll want to change
~/.npmto the directory with permissions issues.
- 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.