Gulamabbas Mawji
npm logo

Install npm packages without sudo

Stop those pesky npm errors

Just a quick tip really I suppose, I recently re-installed and came across the dreaded npm errors when installing Angular CLI.

Simply set yourself as the owner of the node_modules directory and you no longer get asked for sudo access as npm can write to that folder 😄

sudo chown -R $(whoami) /usr/local/lib/node_modules

Run the above command (you will get asked for your password as you are executing a sudo command) and you can install npm packages with ease now.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.