Why does npm need sudo for EVERYTHING?

后端 未结 3 1718
耶瑟儿~
耶瑟儿~ 2021-01-14 14:59

I don\'t know how I\'ve managed it but npm seems to need sudo for absolutely every command, even npm help does not work without sudo. If I use a co

3条回答
  •  走了就别回头了
    2021-01-14 15:26

    I encountered the same error after a fresh install of 0.12.4 today; this solved the problem for me:

    sudo chown -R $(whoami):admin /usr/local/lib/node_modules
    

    In my particular case, I noticed that this folder was owned by '{some-large-integer-account}:wheel'...YMMV

    If that doesn't solve it, take a look at the ownership of the folders that are being blocked as mentioned in the EACCESS error trace. If you're not sure what the ownership should be, you can usually infer it from the sibling dirs' ownership.

提交回复
热议问题