These three steps worked for me to remove the constant npm
EACCESS errors I was recieving.
- Reclaim ownership of the
.npm
directory - Add need write permissions for the
node_modules
directory - Finally sort the ownership of the npm
bin
too
From the terminal use the following commands to achieve the above"
$ sudo chown -R `whoami` ~/.npm
$ sudo chown -R `whoami` /usr/local/lib/node_modules
$ chown -R `whoami` `npm -g bin`
Lately, I'e run into a few additional errors that can be resolved similarly. These obviously affect the npm config and cache permissions.
$ sudo chown -R `whoami` ~/.config
$ sudo chown -R `whoami` ~/.cache