Reputation: 49843
I followed this article https://docs.npmjs.com/getting-started/fixing-npm-permissions (SECOND OPTION IN PAGE) to be able to install global modules without having to use sudo
It works, but now i would like to revert permissions to use sudo
again, do you have any advice or clue for this? Do i have to uninstall node and npm ?
I am on a mac osx thank you for any help.
Upvotes: 1
Views: 444
Reputation: 4050
For Option 1:
Change directories owner back to root
sudo chown -R root $(npm config get prefix)/{lib/node_modules,bin,share}
For Option 2:
Change npm prefix back to default (in many cases including OSX default is /usr/local
), remove folders and env variables.
Assuming you named directories and files like in manual:
npm config set prefix '/usr/local'
rm -r ~/.npm-global
rm ~/.profile
If you set NPM_CONFIG_PREFIX
env variable:
unset NPM_CONFIG_PREFIX
Note about PATH variable:
It should be fine after reboot, also you can manually set it to value without ~/.npm-global/bin
section.
Upvotes: 2