Skip to content
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

ng update doesn't work with Yarn PnP #26505

Open
1 task
michaelfaith opened this issue Nov 27, 2023 · 0 comments · May be fixed by #26695
Open
1 task

ng update doesn't work with Yarn PnP #26505

michaelfaith opened this issue Nov 27, 2023 · 0 comments · May be fixed by #26695
Labels
area: angular/cli freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix

Comments

@michaelfaith
Copy link
Contributor

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

When running ng update <library> in a project that uses Yarn PnP, the command fails with the following error

Package '@angular/material' is not a dependency.

This was reported in the PnP support status thread and a work around listed here #16980 (comment)

The workaround requires temporarily disabling PnP, running the update, and then re-enabling PnP, which is not a great experience.

Minimal Reproduction

Run ng update @angular/core in a project that's set up with Yarn pnp.

Exception or Error

ng update @angular/core @angular/cli @angular/material                                                             
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 17.0.3 to perform the update.
√ Packages successfully installed.
Using package manager: yarn
Collecting installed dependencies...
Found 0 dependencies.
Package '@angular/core' is not a dependency.

Your Environment

`ng version` also doesn't work in PnP

Running update with 17.0.3 on a project that has 16.2.1 installed.
Node 18.13.0
Yarn 4.0.2
Win x64

Anything else relevant?

I believe the code responsible for this issue is this utils function that gathers all dependencies from the project's package.

https://github.com/angular/angular-cli/blob/main/packages/angular/cli/src/utilities/package-tree.ts#L53-L86

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: angular/cli ng update DX labels Nov 28, 2023
dominicbachmann added a commit to dominicbachmann/angular-cli that referenced this issue Dec 17, 2023
Extend findPackageJson function to also work when using Yarn PnP

Fixes angular#26505
@dominicbachmann dominicbachmann linked a pull request Dec 17, 2023 that will close this issue
13 tasks
dominicbachmann added a commit to dominicbachmann/angular-cli that referenced this issue Dec 17, 2023
Extend findPackageJson function to also work when using Yarn PnP

Fixes angular#26505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: angular/cli freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants