fix npm permissions

After installing nodejs, we need to install npm packages to include module likes async, request, etc. We need to fix npm permissions for a current so he can have permissions to write to directories that npm will use to store global packages.

You will get this permission error while installing npm packages globally without ‘sudo’.

npm ERR! Error: EACCES, ....

Fixing npm permissions in terminal-
npm config get prefix
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

For more information read https://docs.npmjs.com/getting-started/fixing-npm-permissions

Leave a Reply

Your email address will not be published. Required fields are marked *