npm throws error without sudo

前端 未结 30 1976
清酒与你
清酒与你 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:03

    On Mac OS X, when installing with Homebrew's brew install npm, the installation path is /usr/local/share/npm/ with both bin/ and lib/node_modules/ subfolders.

    Running this command to change to owner to your currently logged in user should fix it all up, and allow you to install global NPM packages without sudo.

    sudo chown -R $USER ~/.npm /usr/local/share/npm/
    

    osx homebrew

提交回复
热议问题