为什么在 Windows 10 上 npm 前缀总是设置为 system32? [英] Why is npm prefix always set to system32 on Windows 10?

查看:70
本文介绍了为什么在 Windows 10 上 npm 前缀总是设置为 system32?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Windows 10 上安装了 Node v4.4.7,但是我遇到了一个问题,即当我运行 npm installnpm 找不到 package.json 文件> 在正确的目录中.

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.

我得到的错误是 ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'这看起来很奇怪,因为我目前不在 C:\Windows\System32 而是 pwd 会显示我在 C:\ao\AO Hybrid代码>

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

这让我检查返回 C:\Windows\System32npm prefix.我已经在 npm v.2.15.8 和 v.3.10.8 上尝试过,结果相同.

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.

如何确保 npm 在本地而不是在 system32 中搜索包?

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

推荐答案

原来我的工作场所在注册表中设置了HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\Autorun 键来改变我的当前工作目录到 system32,导致问题.

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.

这篇关于为什么在 Windows 10 上 npm 前缀总是设置为 system32?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆