Search code examples
npmpermissions

On npm install: Unhandled rejection Error: EACCES: permission denied


I have managed to corrupt my npm install, and whenever I try to install packages using npm install, I receive error messages along these lines:

Unhandled rejection Error: EACCES: permission denied, open '/Users/marknorgate/.npm/_cacache/tmp/a449402d'

I have tried reinstalling node & npm, and I have also tried to relocate my npm cache elsewhere using these instructions but nothing works.

How can I get it working?


Solution

  • Restore ownership of the user's npm related folders, to the current user, like this:

    sudo chown -R $USER:$GROUP ~/.npm
    sudo chown -R $USER:$GROUP ~/.config