node.jswindowsnpmsystem32

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


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?


Solution

  • 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.