npm throws error without sudo

前端 未结 30 2419
清酒与你
清酒与你 2020-11-21 07:43

I just installed node and npm through the package on nodejs.org and whenever I try to search or install something with npm it throws the following error, unless I sudo the c

30条回答
  •  不要未来只要你来
    2020-11-21 07:58

    For me, execute only

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

    doesn't work. Then, I execute too

    sudo chown -R $(whoami) /usr/lib/node_modules/
    sudo chown -R $(whoami) /usr/bin/node
    sudo chown -R $(whoami) /usr/bin/npm
    

    And all works fine!

提交回复
热议问题