ng项未被识别为cmdlet的名称, [英] the term ng is not recognized as the name of a cmdlet in angular

查看:545
本文介绍了ng项未被识别为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.1 npm v是6.12.1

node v is 12.13.1 npm v is 6.12.1

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

我按照以下链接中给出的步骤尝试更新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.

推荐答案

打开节点JS命令提示符

Open Node JS command Prompt

首先在全局范围内卸载angular cli

First uninstall angular cli globally

npm卸载-g @ angular/cli

npm缓存清理--force

安装最新的角度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项未被识别为cmdlet的名称,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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