Angular-使用ng update命令升级到Angular7.1.4
Angular CLI 是 Angular 的一个命令行工具,可以便捷的执行创建项目、创建文件、测试、打包和发布等任务。
关于 Angular 版本
Angular 2.x及以上统称Angular. Angular 1.x 则称为 AngularJS.
Angular 2 发布于 2016年09月14日。
Angular 4 发布于 2017年03月23日。
Angular 5 发布于 2017年11月01日。
Angular 6 发布于 2018年05月03日。
Angular 7 发布于 2018年10月18日。
安装 Angular CLI
使用npm命令安装@angular/cli:
$ npm install -g @angular/cli
参数-g表示全局安装。
代码实例:
$ npm install -g @angular/cli
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
+ @angular/cli@7.1.4
updated 9 packages in 16.798s
使用ng update命令更新Angular
使用 ng update 命令可以查看更新:
如果有packages更新,会提示出来,并给出更新命令:
$ ng update
We analyzed your package.json, there are some packages to update:
Name Version Command to update
-----------------------------------------------------------
@angular/cli 7.1.3 -> 7.1.4 ng update @angular/cli
@angular/core 7.1.3 -> 7.1.4 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.4\" (was \"7.1.3\")...
UPDATE package.json (1528 bytes)
updated 9 packages in 20.362s
再次查看,还有@angular/core需要更新:
$ ng update
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------
@angular/core 7.1.3 -> 7.1.4 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/compiler-cli @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/language-service @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/core @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/common @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/platform-browser @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/compiler @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/animations @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/router @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/forms @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/platform-browser-dynamic @ \"7.1.4\" (was \"7.1.3\")...
Updating package.json with dependency @angular/http @ \"7.1.4\" (was \"7.1.3\")...
UPDATE package.json (1528 bytes)
updated 11 packages in 49.411s
再次使用 ng update 检测,已经没有新的更新了。
$ ng update
We analyzed your package.json and everything seems to be in order. Good work!
使用 ng version 查看当前版本:
$ ng version
Angular CLI: 7.1.4
Node: 10.11.0
OS: darwin x64
Angular: 7.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.6
@angular-devkit/build-angular 0.10.6
@angular-devkit/build-optimizer 0.10.6
@angular-devkit/build-webpack 0.10.6
@angular-devkit/core 7.0.6
@angular-devkit/schematics 7.1.4
@ngtools/webpack 7.0.6
@schematics/angular 7.1.4
@schematics/update 0.11.4
rxjs 6.3.3
type 3.1.6
webpack 4.19.1
参考链接
https://github.com/angular/angular-cli/wiki
[END]
继续阅读与本文标签相同的文章
上一篇 :
东航保障进博明星展品:第二代“会飞的汽车”
-
阿里云与MongoDB达成战略合作,成全球唯一提供最新版MongoDB的云厂商
2026-05-16栏目: 教程
-
Cassandra数据迁移-BulkLoad离线工具介绍
2026-05-16栏目: 教程
-
Cassandra CDC初体验
2026-05-16栏目: 教程
-
带你读《射频集成电路及系统设计》之二:射频信号与系统
2026-05-16栏目: 教程
-
运维编排场景系列----基于镜像的日常发布
2026-05-16栏目: 教程
