npm throws error without sudo

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

    This is how I solved the issue on Windows 8.1:

    • Go to your nodejs install (usually C:\Program Files\nodejs)
    • Right click node_modules folder and go to properties
    • Click the Security tab and advanced
    • At the top you will see "Owner: SYSTEM", click change
    • Enter the user you want permissions for and click Ok
    • Check the box at the bottom of the advanced settings "Replace all child object permission entries with inheritable permission entries from this object" and click ok
    • Do whatever npm install/update you need

提交回复
热议问题