修复 Windows 8 和 10 中的 npm 路径 [英] Fixing npm path in Windows 8 and 10

查看:30
本文介绍了修复 Windows 8 和 10 中的 npm 路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌搜索了很多,尝试使用官方安装程序重新安装 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:

  1. 使用全局搜索功能搜索环境变量"
  2. 点击编辑系统环境变量"
  3. 点击对话框中的环境变量".
  4. 在系统变量"框中,搜索路径并编辑它以包含 C:Program Files odejs.确保它通过 ; 与任何其他路径分开.
  1. Use the global Search Charm to search "Environment Variables"
  2. Click "Edit system environment variables"
  3. Click "Environment Variables" in the dialog.
  4. 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屋!

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