[Bug?]: Yarn 3+ does not connect properly some dependencies, making them unreachable
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
My package pure-rand
is using a library called fast-check
to test itself (declared as a devDependency). Unfortunately when installing this dependency locally, yarn somehow skips some of the dependencies needed by fast-check
to be able to run.
More precisely, under the hood, fast-check
(test framework) is leveraging pure-rand
as a dependency, so yarn somehow skips it: neither installed from npm nor simlink-ed. Whenever entering a file asking the require/import of pure-rand
, node fails with:
Error: Cannot find module 'pure-rand'
To reproduce
I tried to extract a minimal repro of the issue at: https://github.com/dubzzz/yarn-3-repro-pure-rand
Basically here are the two main characteristics that make it fails:
- package name matches the one asked by
fast-check
- version matches the requirements of
fast-check
On my side, I was either expecting Yarn to pull the version of pure-rand from the npm registry or to simlink the one defined within the repository.
Environment
System:
OS: Windows 10 10.0.22623
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Binaries:
Node: 16.14.0 - C:\Users\N4442~1.DUB\AppData\Local\Temp\xfs-67e9fc28\node.CMD
Yarn: 3.3.0 - C:\Users\N4442~1.DUB\AppData\Local\Temp\xfs-67e9fc28\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Additional context
If the “bug” is confirmed and depending how complex it is to fix, with good pointers I could potentially give a hand and fix it.
Issue Analytics
- State:
- Created 10 months ago
- Comments:14 (14 by maintainers)
To be clear, I think the node-modules linker should still create a symlink in
node_modules/pure-rand/node_modules/fast-check -> ../../../
, but yep,enableTransparentWorkspaces: false
should do the trick if you’re fine with using the your own package as any other dependency (it’s what Babel does as well, since they depend on themselves to compile their own sources).@dubzzz Thanks, I will reevalute tomorrow thoroughly with @arcanis, looks like he understand your issue and I will come back to you