'npm' 不是内部或外部命令、可运行程序或批处理文件 [英] 'npm' is not recognized as internal or external command, operable program or batch file
问题描述
我对 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
- 使用 Chocolatey 安装 ==> 无法识别 npm
- 使用来自 nodejs.org 的 64 位 nodejs 安装程序安装 ==> 无法识别 npm
- 在这个阶段,运行
where npm
会给我c:User<Username>AppDataRoaming pm
里面什么都没有 - 我发现 nodejs 安装在
C:Program Files odejs
中.在此目录中打开命令提示符可使npm
正常工作. - 所以我将
C:Program Files odejs
添加到PATH
只是为了再次得到相同的错误npm 无法识别
李> - nodejs 存储库上的一个 github 问题说我需要重新启动机器,它会修复.但这到目前为止没有帮助
- 我确实在
Start -> 中看到了一个
菜单将我带到 nodejs 控制台,但不知道该怎么做.Node.js
图标Programms
- Install using Chocolatey ==> npm is not recognised
- Install using 64-bit nodejs installer from nodejs.org ==> npm is not recognised
- At this stage, running
where npm
gives mec:User<Username>AppDataRoaming pm
which has nothing in it - I figure out that nodejs is installed in
C:Program Files odejs
. Opening a command prompt in this directory makesnpm
work fine. - So I added
C:Program Files odejs
toPATH
only to get the same error again thatnpm is not recognized
- 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
- I do see a
Node.js
icon in myStart -> 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屋!