欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Angular-使用ng update命令升级到Angular7.1.2

程序员文章站 2022-04-10 14:05:59
...

Angular-使用ng update命令升级到Angular7.1.2

Angular CLI 是 Angular 的一个命令行工具,可以便捷的执行创建项目、创建文件、测试、打包和发布等任务。

Angular 版本

Angular 2.x及以上统称Angular, Angular 1.x 则称为 AngularJS.

Angular 5 发布于 2017年11月01日。
Angular 6 发布于 2018年05月03日。
Angular 7 发布于 2018年10月18日。

安装 Angular CLI

$ npm install -g @angular/cli

使用ng update命令更新Angular

使用 ng update 命令查看更新:

$ ng update
We analyzed your package.json, there are some packages to update:
  Name             Version          Command to update
 -----------------------------------------------------------
  @angular/cli     7.1.1 -> 7.1.2   ng update @angular/cli
  @angular/core    7.1.1 -> 7.1.2   ng update @angular/core

There might be additional packages that are outdated.
Run "ng update --all" to try to update all at the same time.

使用 ng update 更新 @angular/cli 包:

$ ng update @angular/cli
    Updating package.json with dependency @angular/cli @ "7.1.2" (was "7.1.1")...
UPDATE package.json (1528 bytes)
updated 10 packages in 18.119s

再次查看:

$ ng update
We analyzed your package.json, there are some packages to update:
  Name             Version            Command to update
 --------------------------------------------------------------
  @angular/core    7.1.1 -> 7.1.2     ng update @angular/core

There might be additional packages that are outdated.
Run "ng update --all" to try to update all at the same time.

使用 ng update 更新 @angular/core 包:

$ ng update @angular/core
Updating package.json with dependency @angular/language-service @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/animations @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/compiler @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/compiler-cli @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/router @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/platform-browser @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/common @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/http @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/forms @ "7.1.2" (was "7.1.1")...
Updating package.json with dependency @angular/core @ "7.1.2" (was "7.1.1")...
UPDATE package.json (1528 bytes)
updated 11 packages in 48.459s

再次使用 ng update 检测,已经没有新的更新了。

$ ng update              
    We analyzed your package.json and everything seems to be in order. Good work!

使用 ng v 查看当前版本:

$ ng v

Angular CLI: 7.1.2
Node: 10.11.0
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.11.2
@angular-devkit/core         7.1.2
@angular-devkit/schematics   7.1.2
@schematics/angular          7.1.2
@schematics/update           0.11.2
rxjs                         6.3.3
typescript                   3.1.6

参考链接

https://github.com/angular/angular-cli/wiki

[END]

相关标签: Angular