angular-cli: Broken ng update for Angular 8 (would install 9.0.0.next-2)
🐞 Bug report
Command (mark with an x
)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ x ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, it worked in previous versions.
Description
Here is my ng update
:
Using package manager: 'npm'
Collecting installed dependencies...
Found 51 dependencies.
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/cdk 8.1.1 -> 8.1.3 ng update @angular/cdk
@angular/cli 8.1.2 -> 8.2.2 ng update @angular/cli
@angular/core 8.1.2 -> 8.2.2 ng update @angular/core
@angular/material 8.1.1 -> 8.1.3 ng update @angular/material
🔥 Exception or Error
Using package manager: 'npm'
Collecting installed dependencies...
Found 51 dependencies.
Fetching dependency metadata from registry...
Package "@angular/common" has an incompatible peer dependency to "@angular/core" (requires "9.0.0-next.2" (extended), would install "8.2.2").
Package "@angular/platform-browser" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
Package "@angular/common" has an incompatible peer dependency to "@angular/core" (requires "9.0.0-next.2", would install "8.2.2")
Package "@angular/flex-layout" has an incompatible peer dependency to "@angular/common" (requires ">=8.0.0-rc.5", would install "9.0.0-next.2").
Package "@angular/forms" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
Package "@angular/platform-browser-dynamic" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
Package "@angular/router" has an incompatible peer dependency to "@angular/common" (requires "8.2.2", would install "9.0.0-next.2")
Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
You can use the '--force' option to ignore incompatible peer dependencies and instead address these warnings later.
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.1.2
Node: 12.6.0
OS: linux x64
Angular: 8.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.2
@angular-devkit/build-angular 0.801.2
@angular-devkit/build-optimizer 0.801.2
@angular-devkit/build-webpack 0.801.2
@angular-devkit/core 8.1.2
@angular-devkit/schematics 8.1.2
@angular/cdk 8.1.1
@angular/flex-layout 8.0.0-beta.26
@angular/material 8.1.1
@ngtools/webpack 8.1.2
@schematics/angular 8.1.2
@schematics/update 0.801.2
rxjs 6.5.2
typescript 3.4.5
webpack 4.35.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 19 (2 by maintainers)
For me it works in two steps.
Instead of update all together or one by one.
The first ticket has been opened 2 months ago (!), still nothing about it and the reference ticket is now closed because “too heated”? I don’t want to be mean, but this is not very serious. There might be a reason it becomes too heated seen nothing happens and new people continue to raise the problem… End-users are not supposed to spend time on github looking for this. The bare minimum would be to put a notice and give the workaround in the official documentation: https://update.angular.io/#7.2:8.0 (step :
ng update @angular/material
).It turns out the unwanted upgrade 8.2.x -> 9.0.0-next.x also patches many sources files to Angular 9 (!) but -by chance (?)- this does not seem to have any effect. So it seems enough to just patch the
package.json
afterwards and downgrade manually all the 9.0.0-next to their 8.2.x version before the angular/material upgrade (probably all the angular packages except material & cdk), and runnpm install
again. But this should not be an acceptable solution for such a tool.The ticket is closed as a duplicate of #14980 which is still not resolved – but too heated so closed. No news since.
@mgechev @clydin Do you have any news to share regarding this issue? As you know, it has been raised 2 months ago now, and is breaking the whole update process for many people at least.
Can you perhaps provide a temporary workaround to update by hand if it’s easier? When you are not inside the Angular project team, it is not trivial to know which
@angular/xxx
to update to which versions, with build packages & all.In the current state, update.angular.io gives non-working instructions. So for example I cannot update one of my projects that is still in v7.
I’m sure v9 asks for all your attention, please let us know if there is something we can do to help get update-process back again.
Why is the ticket closed?
In addition to emojis, I’d like to confirm that @tristanlins solution worked for me, and provide my exact process, initial and intermediary states in case it helps anyone; it does not require manually fiddling with
package.json
.Process
My initial state
When updating @angular/cli @angular/core rxjs
ℹ️ Recall that you need a clean working copy to run
ng update
, so you have to make an intermediary commit here.When updating @angular/cdk @angular/material
My final state
/cc #14980
same probleme here when i run ng update as mentioned below
i got ‘9.0.0-next.3’
@clydin please can you give us an update on this?