'npm' 不是内部或外部命令、可运行程序或批处理文件 [英] 'npm' is not recognized as internal or external command, operable program or batch file

查看:50
本文介绍了'npm' 不是内部或外部命令、可运行程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 nodejs 完全陌生.我试图让 nodejs 在我的 Windows 2008 机器上工作,以便安装我将用于 TDDing 我的 AngularJs 代码的 Karma.到目前为止,我已经完成了以下步骤

I am completely new to nodejs. I am trying to get nodejs to work on my Windows 2008 box in order to install Karma which I would use for TDDing my AngularJs code. I have done the following steps so far

  1. 使用 Chocolatey 安装 ==> 无法识别 npm
  2. 使用来自 nodejs.org 的 64 位 nodejs 安装程序安装 ==> 无法识别 npm
  3. 在这个阶段,运行 where npm 会给我 c:User<Username>AppDataRoaming pm 里面什么都没有
  4. 我发现 nodejs 安装在 C:Program Files odejs 中.在此目录中打开命令提示符可使 npm 正常工作.
  5. 所以我将 C:Program Files odejs 添加到 PATH 只是为了再次得到相同的错误 npm 无法识别
  6. nodejs 存储库上的一个 github 问题说我需要重新启动机器,它会修复.但这到目前为止没有帮助
  7. 我确实在 Start -> 中看到了一个 Node.js 图标Programms 菜单将我带到 nodejs 控制台,但不知道该怎么做.
  1. Install using Chocolatey ==> npm is not recognised
  2. Install using 64-bit nodejs installer from nodejs.org ==> npm is not recognised
  3. At this stage, running where npm gives me c:User<Username>AppDataRoaming pm which has nothing in it
  4. I figure out that nodejs is installed in C:Program Files odejs. Opening a command prompt in this directory makes npm work fine.
  5. So I added C:Program Files odejs to PATH only to get the same error again that npm is not recognized
  6. One of the github issues on nodejs repository says that I need to restart the machine and it would fix. But that has not helped so far
  7. I do see a Node.js icon in my Start -> Programms mennu which takes me to nodejs console but not sure what to do with that.

我是否错过了这个过程中的任何重要步骤?

Have I missed any important step in the process?

我发现如果我从程序文件中打开Nodejs 命令提示符",那么 npm 就会被识别.如何让它在正常的命令提示符下工作?

I figured out that if I open "Nodejs command prompt" from program files, then npm is recognized. How do I make it work on a normal command prompt?

node 之后,我开始面临另一个应用程序的类似问题.我发布了 这个问题 在超级用户上,正如接受的答案正确指出的那样,我的 PATH 中有一个额外的引号,这导致引号后添加的所有路径出现问题.我有一种感觉,一些 Chocolatey 安装添加了这个令人不安的引用,但我不确定是哪一个.

After node I started facing a similar problem with another application. I posted this question on superuser and as rightly pointed out by the accepted answer, I had an additional quote in my PATH which was causing issues with all the paths added after the quote. I have a feeling that some Chocolatey install adds this troubling quote but I am just not sure which one.

推荐答案

安装node后别忘了重启电脑!那个抓住了我.

Don't forget to reboot your computer after installing node! That one got me.

这篇关于'npm' 不是内部或外部命令、可运行程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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