Install npm packages without sudo

By Tim Kamanin

1) Set yourself as an owner of ~/.npm directory, like this:

sudo chown -R $(whoami) ~/.npm

and if error persists, set yourself as an owner /usr/local/lib/node_modules directory too, like this:

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

Now you can install npm packages without sudo.

 

Copy from https://timonweb.com/posts/install-npm-packages-without-sudo/

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s