Skip to content

[Bug]: yarn adds packageManager field even if standard devEngines is defined during update #6744

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

Open
1 task
trivikr opened this issue Mar 29, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@trivikr
Copy link
Contributor

trivikr commented Mar 29, 2025

Self-service

  • I'd be willing to implement a fix

Describe the bug

yarn adds packageManager field even if standard devEngines is defined during update

To reproduce

$ npm i -g corepack

$ echo '{"devEngines": {"packageManager": {"name": "yarn", "version": "4.7.0"} } }' > package.json

$ yarn --version
4.7.0

$  yarn set version 4.8.0
➤ YN0000: Done in 0s 2ms

$ yarn
"packageManager" field is set to "yarn@4.8.0" which does not match the value defined in "devEngines.packageManager" for "yarn" of "4.7.0"

Observed

packageManager field is set to correct version of yarn, while devEngines.packageManager is not updated

$ cat package.json
{
  "devEngines": {
    "packageManager": {
      "name": "yarn",
      "version": "4.7.0"
    }
  },
  "packageManager": "yarn@4.8.0"
}

Expected

packageManager field is not added, and devEngines.packageManager.version is update to 4.8.0

$ cat package.json
{
  "devEngines": {
    "packageManager": {
      "name": "yarn",
      "version": "4.8.0"
    }
  }
}

Environment

System:
    OS: macOS 15.3.1
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 22.14.0 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-050f7851/node
    Yarn: 4.8.0 - /private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/xfs-050f7851/yarn
    npm: 10.9.2 - ~/.local/state/fnm_multishells/19028_1743286080122/bin/npm

Additional context

No response

@trivikr trivikr added the bug Something isn't working label Mar 29, 2025
@trivikr
Copy link
Contributor Author

trivikr commented Mar 29, 2025

Fixed in my project by manually updating devEngines.packageManager.version, and removing packageManager field
Commit: aws/aws-sdk-js-codemod@0a36eff in aws/aws-sdk-js-codemod#984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant