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)

Most upvoted comments

For me it works in two steps.

# first
$ ng update @angular/cli @angular/core rxjs
# second
$ ng update @angular/cdk @angular/material

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 run npm 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

ng update @angular/cli @angular/core rxjs
git commit -am "update @angular/cli @angular/core rxjs"

ng update @angular/cdk @angular/material
git commit -am "update @angular/cdk @angular/material"

My initial state

Angular CLI: 8.0.6
Node: 12.10.0
OS: win32 x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.6
@angular-devkit/build-angular     0.800.6
@angular-devkit/build-optimizer   0.800.6
@angular-devkit/build-webpack     0.800.6
@angular-devkit/core              8.0.6
@angular-devkit/schematics        8.0.6
@angular/cdk                      8.0.2
@angular/cli                      8.0.6
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.0.2
@ngtools/webpack                  8.0.6
@schematics/angular               8.0.6
@schematics/update                0.800.6
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.30.0

When updating @angular/cli @angular/core rxjs

> ng update @angular/cli @angular/core rxjs

Your global Angular CLI version (8.3.5) is greater than your local
version (8.0.6). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
Using package manager: 'npm'
Collecting installed dependencies...
Found 37 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/cli @ "8.3.5" (was "8.0.6")...
    Updating package.json with dependency @angular/core @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency rxjs @ "6.5.3" (was "6.4.0")...
    Updating package.json with dependency @angular/language-service @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/compiler-cli @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/animations @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/compiler @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/forms @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/common @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/router @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/platform-browser @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "8.2.7" (was "8.0.3")...
    Updating package.json with dependency typescript @ "3.5.3" (was "3.4.5")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.803.5" (was "0.800.6")...
UPDATE package.json (1678 bytes)

> core-js@3.2.1 postinstall F:\dev\aart\app\ui\node_modules\core-js
> node scripts/postinstall || echo "ignore"


> @angular/cli@8.3.5 postinstall F:\dev\aart\app\ui\node_modules\@angular\cli
> node ./bin/postinstall/script.js

added 189 packages from 84 contributors, removed 15 packages, updated 111 packages and audited 20894 packages in 66.409s
found 0 vulnerabilities

ℹ️ 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

> ng update @angular/cdk @angular/material

Using package manager: 'npm'
Collecting installed dependencies...
Found 37 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/cdk @ "8.2.0" (was "8.0.2")...
    Updating package.json with dependency @angular/material @ "8.2.0" (was "8.0.2")...
UPDATE package.json (1678 bytes)
updated 2 packages and audited 20894 packages in 10.659s
found 0 vulnerabilities

My final state

Angular CLI: 8.3.5
Node: 12.10.0
OS: win32 x64
Angular: 8.2.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.5
@angular-devkit/build-angular     0.803.5
@angular-devkit/build-optimizer   0.803.5
@angular-devkit/build-webpack     0.803.5
@angular-devkit/core              8.3.5
@angular-devkit/schematics        8.3.5
@angular/cdk                      8.2.0
@angular/cli                      8.3.5
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.2.0
@ngtools/webpack                  8.3.5
@schematics/angular               8.3.5
@schematics/update                0.803.5
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

/cc #14980

same probleme here when i run ng update as mentioned below

@angular/cdk                       7.2.1 -> 8.1.3           ng update @angular/cdk
      @angular/material                  7.2.1 -> 8.1.3           ng update @angular/material

i got ‘9.0.0-next.3’

@clydin please can you give us an update on this?