yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.44k stars 1.11k forks source link

[Bug?]: The `yarn dedupe` command fails if there is `esbuild` package in the workspace package.json #6176

Open manoraj opened 7 months ago

manoraj commented 7 months ago

Self-service

Describe the bug

The yarn dedupe command fails with Error: Assertion failed: The package (--locatorHash--) should have been registered.

To reproduce

Create a small package.json with

"dependencies": { "@yarnpkg/builder": "^3.3.0", "esbuild": "^0.15.18" }

Run yarn and yarn dedupe.

Expected: The dedupe command should work. Actual: The dedupe command fails with Error: Assertion failed: The package (--locatorHash--) should have been registered

Environment

System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.17.1 - /private/var/folders/x2/2sz9b9b9655ct3zqnwfhfpmh0000gn/T/xfs-e8030edc/node
    Yarn: 3.6.1
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
    bun: 1.0.2 - /opt/homebrew/bin/bun

Additional context

The command works if we remove the esbuild from the package.json. Looks like the npm alias @yarnpkg/builder has "esbuild": "npm:esbuild-wasm@^0.15.15" is causing this issue.

BasixKOR commented 1 month ago

I was also experiencing this issue, and it seems like it only fails when user has actual stale resolution of esbuild, meaning this cannot be reliably reproduced unless user manually edits out the lockfile.