berry icon indicating copy to clipboard operation
berry copied to clipboard

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

Open manoraj opened this issue 1 year ago • 1 comments

Self-service

  • [X] I'd be willing to implement a fix

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.

manoraj avatar Mar 20 '24 04:03 manoraj

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.

BasixKOR avatar Sep 21 '24 14:09 BasixKOR