npm throws error without sudo

前端 未结 30 2589
清酒与你
清酒与你 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 08:15

    Actually, I was also having the same problem. I was running Ubuntu. Mine problem arises because I'd lost my public key of the Ubuntu. Even updating my system was not happening. It was giving GPG error. In that case, you can regain your key by using this command:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 
    

    After that npm works fine!

提交回复
热议问题