无法将术语"ng"识别为cmdlet的名称 [英] The term 'ng' is not recognized as the name of a cmdlet

查看:449
本文介绍了无法将术语"ng"识别为cmdlet的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,在学习一些基本的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:

  1. 右键单击我的电脑"(窗口)
  2. 选定的高级系统设置
  3. 点击环境变量"
  4. 在路径"变量下,将第一个值列为%AppData%\npm
  1. Right Clicked on My Computer (windows)
  2. Selected Advanced System Settings
  3. Clicked "Environment Variables"
  4. 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的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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