我已经多次try 卸载Angular CLI以更新它,但即使我按照GitHub上提供的说明进行操作:

  • npm卸载-g@angle/cli
  • NPM缓存清理
  • npm安装-g@angular/cli@latest

当我使用命令ng--version判断时,仍然会得到旧版本:

 angular-cli: 1.0.0-beta.26

 node: 7.7.1
 os: darwin x64

我如何解决这个问题?谢谢

推荐答案

If you are facing issue with angular/cli then use the following commands:
npm uninstall -g angular-cli to uninstall the angular/cli.
npm cache clean to clean your npm cache from app data folder under your username.
use npm cache verify to verify your cache whether it is corrupted or not.
use npm cache verify --force to clean your entire cache from your system.

Note:
You can also delete by the following the paths
C:\Users\"Your_syste_User_name"\AppData\Roaming\npm and
C:\Users\"Your_syste_User_name"\AppData\Roaming\npm-cache
Then use the following command to install latest angular/cli version globally in your system.
npm install -g @angular/cli@latest
To get more information visit github angular-cli update.

Angular相关问答推荐

Angular 和PrimeNg文件Uploader:渲染元件时如何显示选定文件的列表?

如何在构造函数中测试MatDialog.Open

PrimeNg选项卡视图选项卡

Angular MSAL - 对 Bearer 令牌和 AUD 属性的怀疑

Angular 按钮指令错误地附加子元素

包含与 ngFor 相关内容的 HTML 输入

Angular SPA 和 .Net 6 API 之间未连接 Application Insights Map

如何在 Angular 4 中获取 HttpClient 状态码

Angular 2+ 一次性绑定

错误:formControlName 必须与父 formGroup 指令一起使用.您需要添加一个 formGroup 指令

错误 TS1086:无法在 Angular 9 的环境上下文中声明访问器

Angular2 + Jspm.io:使用类decorator 时需要反射元数据垫片

Angular 2中基于Condition条件的点击事件

在 webpack 构建中包含 git commit hash 和 date

unexpected token < 错误

Angular 2中不同页面的多种布局

如何以编程方式触发`valueChanges`?

@HostBinding 与 Angular 中的变量类

formGroup 需要一个 FormGroup 实例

此类通过 SomeModule -> SomeComponent 对消费者可见,但不会从顶级库入口点导出