Skip to content

ng update doesn't work with Yarn PnP #26505

Description

@michaelfaith

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions