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

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

问题描述

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

  1. 右键单击我的电脑(Windows)
  2. 选定的高级系统设置
  3. 点击环境变量"
  4. 在Path"变量下,列出第一个值%AppData%\npm

一旦我这样做了,我就可以关闭 powershell 并重新打开,一切正常.

Once I did that I was able to close powershell and reopen and all worked.

这篇关于术语“ng"未被识别为 cmdlet 的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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