我已经多次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相关问答推荐

列表和映射的SCSS语法

我的验证器收到一个始终为空的可观察值

如何以Angular 显示动态视图模型

无法将项目从 Angular 13 更新到 14

如何从 RxJS 重试中排除某些 url

如何重置表单中的特定字段?

为什么 HttpParams 在 Angular 4.3 中的多行中不起作用

如何在angular 5 中获取基本网址?

Angular Material 模态对话框周围的空白

AOT - Angular 6 - 指令 SomeComponent,预期 0 个参数,但go 有 1 个参数

Angular 2 - 全局 CSS 文件

单元测试错误:无法从同步测试中调用 Promise.then

从另一个组件更新时,如何检测服务变量更改?

如何使用 x-www-form-urlencoded 强制 Angular2 发布

Angular 2 ngfor 第一个,最后一个,索引循环

如何在ng build之后更改 angular-cli 中的 dist 文件夹路径

如何在 Angular 中包含 JavaScript 脚本文件并从该脚本调用函数?

作业(job)名称..getProjectMetadata不存在

将焦点放在 元素上

如何获得 Angular 版本?