npm throws error without sudo

前端 未结 30 2406
清酒与你
清酒与你 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条回答
  •  萌比男神i
    2020-11-21 08:04

    John Papa points to the history and reasoning behind this issue and gives a solid fix:

    John Papa's steps are to:

    1. Use brew to install node without npm
    2. Update your .bash_profile/.bashrc to let npm and node know where to install and find packages
    3. Use brew to update node and npm to update itself

    Hope this helps the curious!

提交回复
热议问题