由于发布了Angular 9版本,所以尝试更新
因为Angular版本9在2020年2月7日(星期五)发布,所以我立即进行了更新。
我参考了以下博客中的更新概要,并按照其中的内容进行了操作。
操作流程
确认当前版本
>ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.25
Node: 11.14.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
-
- Angular: 8.2.14
- Node: 11.14.0
推荐从Angular v8的最终版本升级到Angular v9,如果还没有升级的话,请升级版本。
// v8の最終リリースバージョンにアップデートする。
ng update @angular/core@8 @angular/cli@8
请使用Node v10.13或更高版本。
升级到Angular 9的版本
ng update @angular/core @angular/cli
即使没有指定版本,上述命令也会选择最新的版本。
结局/
ng update @angular/core @angular/cli
The installed Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Using package manager: 'npm'
Collecting installed dependencies...
Found 30 dependencies.
Fetching dependency metadata from registry...
Updating package.json with dependency @angular/cli @ "9.0.4" (was "8.3.25")...
Updating package.json with dependency @angular/core @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular-devkit/build-angular @ "0.900.4" (was "0.803.25")...
Updating package.json with dependency @angular/language-service @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/compiler-cli @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency zone.js @ "0.10.2" (was "0.9.1")...
Updating package.json with dependency @angular/router @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/compiler @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/common @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency rxjs @ "6.5.4" (was "6.4.0")...
Updating package.json with dependency @angular/forms @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/animations @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency @angular/platform-browser @ "9.0.4" (was "8.2.14")...
Updating package.json with dependency typescript @ "3.7.5" (was "3.5.3")...
UPDATE package.json (1289 bytes)
√ Packages installed successfully.
** Executing migrations of package '@angular/cli' **
> Angular Workspace migration.
Update an Angular CLI workspace to version 9.
UPDATE angular.json (3637 bytes)
UPDATE tsconfig.app.json (272 bytes)
UPDATE package.json (1292 bytes)
√ Packages installed successfully.
Migration completed.
> Lazy loading syntax migration.
Update lazy loading syntax to use dynamic imports.
Migration completed.
> Replace deprecated 'styleext' and 'spec' Angular schematic options.
Migration completed.
** Executing migrations of package '@angular/core' **
> Static flag migration.
Removes the `static` flag from dynamic queries.
As of Angular 9, the "static" flag defaults to false and is no longer required for your view and content queries.
Read more about this here: https://v9.angular.io/guide/migration-dynamic-flag
Migration completed.
> Missing @Injectable and incomplete provider definition migration.
In Angular 9, enforcement of @Injectable decorators for DI is a bit stricter and incomplete provider definitions behave differently.
Read more about this here: https://v9.angular.io/guide/migration-injectable
Migration completed.
> ModuleWithProviders migration.
In Angular 9, the ModuleWithProviders type without a generic has been deprecated.
This migration adds the generic where it is missing.
Read more about this here: https://v9.angular.io/guide/migration-module-with-providers
Migration completed.
> Renderer to Renderer2 migration.
As of Angular 9, the Renderer class is no longer available.
Renderer2 should be used instead.
Read more about this here: https://v9.angular.io/guide/migration-renderer
Migration completed.
> Undecorated classes with decorated fields migration.
As of Angular 9, it is no longer supported to have Angular field decorators on a class that does not have an Angular decorator.
Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
Migration completed.
> Undecorated classes with DI migration.
As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
Migration completed.
Your project has been updated to Angular version 9!
For more info, please see: https://v9.angular.io/guide/updating-to-version-9
我安然无恙地完成了v9。