问题描述
今天,在学习一些基本的AngularJS简介时,我遇到了一个问题.
Today, while working through some basic AngularJS Intro, I ran into a problem.
我打开PowerShell继续进行该项目. NPM工作了.
I opened PowerShell to get going on the project. NPM worked.
我能够使用以下方式安装Angular:
I was able to install the Angular using:
npm install -g @angular/cli
每当我尝试运行ng时,我都会得到:
Anytime I tried to run ng, I would get:
the term 'ng' is not recognized as the name of a cmdlet
推荐答案
path变量中的第一个路径必须是NPM路径.打开Node.js命令提示符,我发现ng命令在那里工作.我研究了该快捷方式,发现它引用了一个命令来确保第一个Path变量是NPM.要解决:
The first path in the path variable needs to be the NPM path. Opening the Node.js command prompt I found that the ng command worked there. I dug into the shortcut and found that it references a command to ensure the first Path variable is NPM.To Fix:
- 右键单击我的电脑"(窗口)
- 选定的高级系统设置
- 点击环境变量"
- 在路径"变量下,将第一个值列为
%AppData%\npm
- Right Clicked on My Computer (windows)
- Selected Advanced System Settings
- Clicked "Environment Variables"
- Under "Path" variable, made the FIRST value listed
%AppData%\npm
一旦这样做,我便可以关闭Powershell并重新打开,并且一切正常.
Once I did that I was able to close powershell and reopen and all worked.
这篇关于无法将术语"ng"识别为cmdlet的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!