The Angular team made upgrading much easier than before. You can get the commands that you need to run to update your project from an Angular version to another one by using the Angular Update Guide.
Head to that interactive guide and specify 7.1.4 as the current version and the target version which is v8.3.2 and click the Show me how to update button.
After specifying the versions, you'll get a warning saying We do not recommend moving across multiple major versions. Since we are moving from v7 to v8:
Angular 8 uses TypeScript 3.4, read more about errors that might arise from improved type checking.
Make sure you are using Node 10 or later.
In you command-line interface run the following command:
$ ng update
This will analyze the package.json
file of your project and give you a list of packages to update with the required commands:
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/cli 7.1.4 -> 8.3.19 ng update @angular/cli
@angular/core 7.1.4 -> 8.2.14 ng update @angular/core
rxjs 6.3.3 -> 6.5.3 ng update rxjs
There might be additional packages that are outdated.
Run "ng update --all" to try to update all at the same time.
So, let's start by updating the core framework and the CLI to v8.2.14 and v8.3.19 respectively using the following command:
$ ng update @angular/cli @angular/core
This will update the core framework and CLI to Angular 8:
Updating package.json with dependency @angular/compiler @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/language-service @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/forms @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/platform-browser @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/platform-browser-dynamic @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/cli @ "8.3.19" (was "7.1.4")...
Updating package.json with dependency @angular/animations @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/common @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency zone.js @ "0.9.1" (was "0.8.26")...
Updating package.json with dependency rxjs @ "6.5.3" (was "6.3.3")...
Updating package.json with dependency @angular/router @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/core @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency @angular/compiler-cli @ "8.2.14" (was "7.1.4")...
Updating package.json with dependency typescript @ "3.5.3" (was "3.1.6")...
Note: On Windows I had to run npm install
after ng update @angular/cli @angular/core
to install the new versions of the dependencies.
Now, let's check the new version of Angular using the following command:
$ ng --version
This is the output of the command:
Angular CLI: 8.3.19
Node: 10.16.3
OS: win32 ia32
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.11.4
@angular-devkit/build-angular 0.11.4
@angular-devkit/build-optimizer 0.11.4
@angular-devkit/build-webpack 0.11.4
@angular-devkit/core 7.1.4
@angular-devkit/schematics 8.3.19
@angular/cli 8.3.19
@ngtools/webpack 7.1.4
@schematics/angular 8.3.19
@schematics/update 0.803.19
rxjs 6.5.3
typescript 3.5.3
webpack 4.23.1
You can see that we have successfully updated Angular CLI to v8.3.19, Angular to v8.2.14 and different core packages. Even TypeScript is bumped to v3.5.3.
I got these instructions from this update guide and this official post