Skip to content

When Upgrading from version A to B, there is always an incompatible peer dependencies issue between CDK and CLI #30464

@mattiLeBlanc

Description

@mattiLeBlanc

Command

update

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hi,
I regularly update my Angular and always run into the same issue:
When I do an ng update, I get this report

  We analyzed your package.json, there are some packages to update:
    
      Name                                       Version                  Command to update
     ----------------------------------------------------------------------------------------
      @angular/cdk                               18.2.14 -> 19.1.3        ng update @angular/cdk
      @angular/cli                               18.2.14 -> 19.1.6        ng update @angular/cli
      @angular/core                              18.2.13 -> 19.1.5        ng update @angular/core
      @angular/material                          18.2.14 -> 19.1.3        ng update @angular/material
      @angular/youtube-player                    18.2.14 -> 19.1.3        ng update @angular/youtube-player

So, first thing I do is commit my changes in repo and run the first update command, ng update @angular/cdk, which always complains about peer dependencies:

          Package "@angular/material" has an incompatible peer dependency to "@angular/cdk" (requires "18.2.14", would install "19.1.3").
✖ Migration failed: 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.
  See "/private/var/folders/75/ksptq6pd4zx_119hqg8hx7ph0000gn/T/ng-zKFf4B/angular-errors.log" for further details.

Well, I havent update Material yet, I start at the top. And pretty sure if I update Material first it will complain about another peer dependency of something that is inline for being updated.

To work around I just use --force for each update command, but that seems like a hack.
Is there a right way to do this or is this just always a chicken and the egg problem?

Minimal Reproduction

Update and version to another version

"devDependencies": {
    "@angular-devkit/build-angular": "^18.2.1",
    "@angular/animations": "^18.2.1",
    "@angular/cdk": "^18.2.1",
    "@angular/cli": "^18.2.1",
    "@angular/common": "^18.2.1",
    "@angular/compiler": "^18.2.1",
    "@angular/compiler-cli": "^18.2.1",
    "@angular/core": "^18.2.1",
    "@angular/elements": "^18.2.1",
    "@angular/forms": "^18.2.1",
    "@angular/material": "^18.2.1",
    "@angular/material-moment-adapter": "^18.2.1",
    "@angular/platform-browser": "^18.2.1",
    "@angular/platform-browser-dynamic": "^18.2.1",
    "@angular/router": "^18.2.1",
    "@angular/youtube-player": "^18.2.1"
}

Exception or Error

Package "@angular/material" has an incompatible peer dependency to "@angular/cdk" (requires "18.2.14", would install "19.1.3").
✖ Migration failed: 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.
  See "/private/var/folders/75/ksptq6pd4zx_119hqg8hx7ph0000gn/T/ng-zKFf4B/angular-errors.log" for further details.

Your Environment

Angular CLI: 18.2.14
Node: 20.14.0
Package Manager: npm 8.19.1
OS: darwin arm64

Angular: 18.2.13
... animations, common, compiler, compiler-cli, core, elements
... forms, platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1802.14
@angular-devkit/build-angular      18.2.14
@angular-devkit/core               18.2.14
@angular-devkit/schematics         18.2.14
@angular/cdk                       18.2.14
@angular/cli                       18.2.14
@angular/material                  18.2.14
@angular/material-moment-adapter   18.2.14
@angular/youtube-player            18.2.14
@schematics/angular                18.2.14
rxjs                               7.8.1
typescript                         5.5.4
zone.js                            0.14.10

Anything else relevant?

No response

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions