问题描述
今天,在学习一些基本的 AngularJS Intro 时,我遇到了一个问题.
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:
- 右键单击我的电脑(Windows)
- 选定的高级系统设置
- 点击环境变量"
- 在Path"变量下,列出第一个值
%AppData%\npm
一旦我这样做了,我就可以关闭 powershell 并重新打开,一切正常.
Once I did that I was able to close powershell and reopen and all worked.
这篇关于术语“ng"未被识别为 cmdlet 的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!