修复 Windows 8 和 10 中的 npm 路径 [英] Fixing npm path in Windows 8 and 10
问题描述
谷歌搜索了很多,尝试使用官方安装程序重新安装 node.js,但我的 npm 路径仍然不起作用.
Have done a lot of googling, tried reinstalling node.js using the official installer, but my npm pathing still doesn't work.
这不起作用
npm install foo
我收到一条错误消息,说缺少模块 npm-cli.js
I get an error message saying missing module npm-cli.js
2 小时的谷歌搜索后,我发现了一个解决方法
我输入
2 hours of googling later I discovered a workaround
Instead of simply 'npm' I type
node C:Program Files
odejs
ode_modules
pmin
pm-cli.js
但是如何更正我的 nodejs 安装,以便我可以简单地输入npm"?
But how can I correct my nodejs install so I can simply type 'npm' ?
推荐答案
您需要将 C:Program Files
odejs
添加到您的 PATH 环境变量中.为此,请执行以下步骤:
You need to Add C:Program Files
odejs
to your PATH environment variable. To do this follow these steps:
- 使用全局搜索功能搜索环境变量"
- 点击编辑系统环境变量"
- 点击对话框中的环境变量".
- 在系统变量"框中,搜索路径并编辑它以包含
C:Program Files odejs
.确保它通过;
与任何其他路径分开.
- Use the global Search Charm to search "Environment Variables"
- Click "Edit system environment variables"
- Click "Environment Variables" in the dialog.
- In the "System Variables" box, search for Path and edit it to include
C:Program Files odejs
. Make sure it is separated from any other paths by a;
.
您必须重新启动所有当前打开的命令提示符才能生效.
You will have to restart any currently-opened command prompts before it will take effect.
这篇关于修复 Windows 8 和 10 中的 npm 路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!