DEV Community

John Peters
John Peters

Posted on

Angular 9 Updates

Just like anything in tech, the more one does something the easier it gets.

Angular 9 updates from version 7 or 8 to 9 have a few finer points one learns after a while.

Get to latest version of 8 first

For both versions 7 and 8. Switch to the directory of the project to be upgraded where the package.json file is located.

ng update @angular/cli@8 @angular/core@8
Enter fullscreen mode Exit fullscreen mode

The results you get may vary dependent on how many things are in your package.json file. We ignored a number of warnings and went on to Angular 9. Thinking we would address later. (may not have been best choice, but it seemed to work for us)

Then move up to Angular 9
The guide on the site says this should work.

ng update @angular/cli @angular/core
Enter fullscreen mode Exit fullscreen mode

After the update finishes (if everything works) type in

ng --version
Enter fullscreen mode Exit fullscreen mode

You should see something like this:

Angular CLI: 9.0.7
Node: 12.14.1
OS: win32 x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.900.7
@angular-devkit/build-angular 0.900.7
@angular-devkit/build-optimizer 0.900.7
@angular-devkit/build-webpack 0.900.7
@angular-devkit/core 9.0.7
@angular-devkit/schematics 9.0.7
@ngtools/webpack 9.0.7
@schematics/angular 9.0.7
@schematics/update 0.900.7
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2

Good so far right? Well not exactly...

If you move back a directory or two and type in ng --version again you may see something different. This is because your global version is different. To fix that, you have to run:

npm install @angular/cli@^9.0.0 -g
Enter fullscreen mode Exit fullscreen mode

Now you should have both the developer and global versions in sync.

Finally, if you have any issues where the upgrade failed, run it again with the
--force option.

JWP2020

Top comments (0)