Permission denied when installing npm module

前端 未结 3 685
悲哀的现实
悲哀的现实 2020-12-13 06:45

I\'m getting a strange permission error when I try to install an npm module. I\'m starting it with sudo so I\'m sure I do have access, but for some reason it ke

相关标签:
3条回答
  • 2020-12-13 07:35

    A rule of thumb as I have learned is to never run npm install with sudo. That creates items with root being the owner as opposed to your username.

    0 讨论(0)
  • 2020-12-13 07:35

    Give full permission to node modules folder

    command

    sudo chmod 777 -R node_modules/

    0 讨论(0)
  • 2020-12-13 07:37

    You need to reclaim ownership of the .npm directory.

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

    and need the write permission in node_modules directory:

    sudo chown -R $(whoami) /usr/lib/node_modules
    
    0 讨论(0)
提交回复
热议问题