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 fails with Yarn #27731

Open
1 task done
LaXiS96 opened this issue May 28, 2024 · 1 comment
Open
1 task done

ng update fails with Yarn #27731

LaXiS96 opened this issue May 28, 2024 · 1 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

Comments

@LaXiS96
Copy link

LaXiS96 commented May 28, 2024

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

<14 probably, not sure as it was a long time ago

Description

While updating a v15 application using Yarn (non-PnP), the ng update command fails with an unhelpful error.
The error claims there is no packageManager field in package.json, which is not true. Even if the field is really missing, ng update adds it but the next run will throw the same error.

The only workaround I found is to use npm to do the update (set packageManager: "[email protected]" in package.json, remove cli.packageManager from angular.json), and then revert to Yarn after the update.

It does not look like a Yarn issue, the behavior is the same with 3.4.1 or 4.2.2.

Minimal Reproduction

  1. corepack enable
  2. npx --package=@angular/cli@15 ng new ng15 --package-manager=yarn
  3. add .yarnrc.yml with content: nodeLinker: node-modules
  4. yarn install
  5. ng update @angular/core@16 @angular/cli@16 --verbose --allow-dirty

Exception or Error

PS > ng update @angular/core@16 --verbose
Locating potential npmrc files:
Locating potential yarnrc files:
Trying 'C:\Users\me\.yarnrc'...found.
Trying 'C:\Users\me\.yarnrc'...found.
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 16.2.14 to perform the update.
! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing [email protected]+sha512.a333bf9c2557d71f5ba87dd1446cde24bb9c35301ec29dd2baba577b3f9d1ab61348b66a1324de9088c40a996c5b9203794da8bf14cab9fae6a6eccc00cb8078.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager

✖ Packages installation failed, see above.

Your Environment

Angular CLI: 15.2.11
Node: 18.20.3
Package Manager: yarn 3.4.1
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.11
@angular-devkit/build-angular   15.2.11
@angular-devkit/core            15.2.11
@angular-devkit/schematics      15.2.11
@angular/cli                    15.2.11
@schematics/angular             15.2.11
rxjs                            7.8.1
typescript                      4.9.5

Anything else relevant?

No response

@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 May 28, 2024
@zstundys
Copy link

I get a similar issue too - using WSL
image

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

No branches or pull requests

3 participants