Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got @angular/* version ~9.0.0-next-0 when tried to upgrade to Angular Material 8 via ng update. Why this discrepancy?

I am trying to upgrade an Angular 7 application to Angular 8 using instructions from here. Everything went well until the last step:

ng update @angular/material

This updated Angular Material packages to 8.1.2, but also upgraded @angular/* packages to a rather strange an undesired version: ~9.0.0-next.0

Angular Material 7 -> 8 upgrade effect

This is problematic (I had to get rid of a non-essential dev dependency that requires Angular <= 8) as I do not want to go beyond version 8 which is the latest stable one.

How should I tackle this?

like image 266
Alexei - check Codidact Avatar asked Jan 27 '23 00:01

Alexei - check Codidact


2 Answers

The problem is that before running a ng update @angular/material some of your dependencies were already on 8.2.0 while @angular/material was still on version 7.

ng update @angular/material apparently only checks if there is update available for @angular/material - not for other dependencies that it might update on the way. So when you launched the command, it noticed that there was a newer version available and it proceeded with updating. Other dependencies got updated as well as they were on a version 8 before doing an update (and there was version 9 available).

This is why you always have to keep an eye that all your versions are aligned before doing an update.

And just a small observation: The 9.0.0-next.0 was released just an hour before you did the update. So if you did it before that, you wouldn't have any of these problems.

The possible fix for this is to manually edit the package.json and change the dependencies with version ^9.0.0-next.0 to ^8.2.0

like image 123
Dino Avatar answered Jan 28 '23 13:01

Dino


The community seems to think this is a bug. See: https://github.com/angular/angular-cli/issues/14980 (scroll down).

like image 38
kanondev7 Avatar answered Jan 28 '23 14:01

kanondev7