Skip to content

ng update wants to update @angular/material in project that does not have it installed #29627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
rubiesonthesky opened this issue Feb 12, 2025 · 2 comments · Fixed by #29629
Closed
1 task done
Assignees
Labels

Comments

@rubiesonthesky
Copy link

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

19.1.6

Description

Running ng update offers update to @angular/material even though it is not installed to the project. The project has @angular/cdk and @angular/cdk-experimental installed.

    We analyzed your package.json, there are some packages to update:

      Name                                Version                  Command to update
     ---------------------------------------------------------------------------------
      @angular/cli                        19.1.6 -> 19.1.7         ng update @angular/cli
      @angular/core                       19.1.5 -> 19.1.6         ng update @angular/core
      @angular/material                   19.1.3 -> 19.1.4         ng update @angular/material

I think it should have @angular/cdk instead of material here.

For some reason, @angular/cdk-experimental is never listed in this list, even though you always need to update it same time as @angular/cdk.

Minimal Reproduction

ng update

Exception or Error


Your Environment

Angular CLI: 19.1.6
Node: 22.11.0
Package Manager: npm 11.0.0
OS: darwin arm64

Angular: 19.1.5
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.6
@angular-devkit/build-angular   19.1.6
@angular-devkit/core            19.1.6
@angular-devkit/schematics      19.1.6
@angular/cdk                    19.1.3
@angular/cdk-experimental       19.1.3
@angular/cli                    19.1.6
@schematics/angular             19.1.6
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

I'm not sure if this should have been reported here or in the components repository.

@rubiesonthesky rubiesonthesky changed the title ng update wants to update @angular/material in project that does not have installed ng update wants to update @angular/material in project that does not have it installed Feb 12, 2025
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 13, 2025
…package groups

Previously, the package group name defaulted to the first item in the list. This update prioritizes an installed package as the fallback instead.

Closes angular#29627
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 13, 2025
…package groups

Previously, the package group name defaulted to the first item in the list. This update prioritizes an installed package as the fallback instead.

Closes angular#29627
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Feb 13, 2025

There are two issues here:

  1. The logs display @angular/material instead of @angular/cdk, likely due to the fallback behavior of the group names. I have a PR to address this here: fix(@angular/cli): prefer installed package as fallback when listing package groups #29629

  2. The package @angular/cdk-experimental is missing from the list. Technically, it should not be listed, similar to how packages like @angular/core and @angular/forms are not explicitly shown. This is because the update command targets a group of packages. However, in this case, @angular/cdk-experimental is not included in any group, which will cause the update to fail. PR here: build: add missing packageGroup fields and packages in package.json components#30486

@alan-agius4 alan-agius4 self-assigned this Feb 13, 2025
alan-agius4 added a commit that referenced this issue Feb 13, 2025
…package groups

Previously, the package group name defaulted to the first item in the list. This update prioritizes an installed package as the fallback instead.

Closes #29627

(cherry picked from commit 09f5006)
@alan-agius4 alan-agius4 marked this as a duplicate of #29643 Feb 14, 2025
@JeanMeche JeanMeche marked this as a duplicate of #29658 Feb 17, 2025
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants