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

后端 未结 16 781
抹茶落季
抹茶落季 2020-12-02 03:51

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:

相关标签:
16条回答
  • 2020-12-02 04:04

    you can try following command for expo :

    sudo chown -R $USER:$GROUP ~/.expo
    
    0 讨论(0)
  • 2020-12-02 04:08

    This one works for me:

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

    I did not use the -g because I am the only user. I used a MacBook Air.

    0 讨论(0)
  • 2020-12-02 04:09

    Above answer didn't work for me. Just try to run your command with --unsafe-perm.

    e.g

    npm install -g node@latest --unsafe-perm
    

    This seems to solve the problem.

    0 讨论(0)
  • 2020-12-02 04:09

    This worked for me!

    Resolving EACCES permissions errors when installing packages globally

    0 讨论(0)
  • 2020-12-02 04:10
    sudo npm cache clean --force --unsafe-perm
    

    and then npm i goes normally

    0 讨论(0)
  • 2020-12-02 04:18

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

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

    0 讨论(0)
提交回复
热议问题