Fix "Error: EACCES" error when running npm install

When I was trying to run npm install some packages (via bundle) yesterday, I got this error:

...
npm ERR! Error: EACCES, open '/home/dangtrinhnt/.npm/-/all/.cache.json'
npm ERR!  { [Error: EACCES, open '/home/dangtrinhnt/.npm/-/all/.cache.json']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/dangtrinhnt/.npm/-/all/.cache.json' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
...

It's a permission issue. So, to fix this: change the owner to myself

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

Comments