[Bug]: Wrong version linked in `node_modules/.bin`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
The wrong version of a dependency X is linked in node_modules/.bin/, but only when in combination with another package, which has a different version of the dependency X in its transitive dependency tree.
To reproduce
Reproduction repository: https://github.com/avaly/yarn-v3-bin-link-bug
The expected version of node_modules/.bin/tsc is 4.7.4.
However when also installing the cdk8s-cli package, yarn links tsc to version 3.9.10.
If you remove the cdk8s-cli dependency in package.json, then tsc is linked correctly to 4.7.4.
Environment
System:
OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Binaries:
Node: 18.0.0 - /tmp/xfs-b91ff550/node
Yarn: 3.2.1 - /tmp/xfs-b91ff550/yarn
npm: 8.1.4 - ~/.volta/tools/image/npm/8.1.4/bin/npm
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction repository at avaly/yarn-v3-bin-link-bug and inspect its package.json dependency combination. Reproduce the install with Yarn 3.2.1, then trace how node_modules/.bin/tsc is linked when TypeScript 4.7.4 and 3.9.10 are both present. Done means the reproduction links tsc to the expected 4.7.4 version while cdk8s-cli remains installed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100