术语 ng 不被识别为 angular 中的 cmdlet 的名称 [英] the term ng is not recognized as the name of a cmdlet in angular

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

问题描述

我对 angular 很陌生,我正在从几个月前开发的一个项目中学习.

I'm very new to angular and i am learning from a project that has been developed some months back.

节点 v 是 12.13.1npm v 是 6.12.1

node v is 12.13.1 npm v is 6.12.1

  • 我在 Windows 操作系统中工作.
  • 当我尝试 ng --version 或 ng -v 或 ng v 时,它显示术语 ng 未被识别为 angular 中的 cmdlet 名称".
  • 但是使用 npm list -global --depth 0 告诉我@angular/cli@8.3.21.
  • 使用 npm start 运行应用程序,因为 ng serve 不起作用.

我尝试按照以下链接中给出的步骤更新 angularCli,但仍然相同.https://www.npmjs.com/package/@angular/cli

I tried Updating angularCli by following the steps given in the below link but still the same. https://www.npmjs.com/package/@angular/cli

请帮我解决这个问题.提前致谢.

please help me to solve this issue. Thanks in advance.

推荐答案

Open Node JS 命令提示

Open Node JS command Prompt

首先全局卸载angular cli

First uninstall angular cli globally

npm uninstall -g @angular/cli

npm 缓存清理 --force

安装最新的 angular cli

Install latest angular cli

npm install -g @angular/cli

您将只能在 Node JS 命令提示符下访问 ng 变量.如果您使用任何其他终端,例如 windows CMD 或 bash ng 命令将不起作用.要使其工作,您需要设置 npm 环境变量.要设置环境变量,您需要管理员权限.

You will be able to access ng variable in Node JS command prompt only. If you are using any other terminal such as windows CMD or bash ng command will not work. To make it work you need to set npm environment variables. To set environment variables you need admin access.

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

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