Why is npm prefix always set to system32 on Windows 10?

天大地大妈咪最大 提交于 2020-02-02 15:25:17

问题


I've just installed Node v4.4.7 on Windows 10 but I am having an issue where npm doesn't find the package.json file when I run npm install in the proper directory.

The error I get is ENOENT: no such file or directory, open 'C:\Windows\System32\package.json' Which seems odd as I am not currently in C:\Windows\System32 but rather pwd would reveal that I am in C:\ao\AO Hybrid

This let me to check npm prefix which returned C:\Windows\System32. I've tried this with both npm v.2.15.8 and v.3.10.8 with the same results.

How can I make sure npm searches for the packages locally instead of in system32?


回答1:


It turns out that my workplace has set the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\Autorun key in the registry to change my current working directory to system32, causing the issue.



来源:https://stackoverflow.com/questions/39785425/why-is-npm-prefix-always-set-to-system32-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!