question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug?]: Yarn 3+ does not connect properly some dependencies, making them unreachable

See original GitHub issue

Self-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:closed
  • Created 10 months ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
arcaniscommented, Nov 22, 2022

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).

1reaction
larixercommented, Nov 21, 2022

@dubzzz Thanks, I will reevalute tomorrow thoroughly with @arcanis, looks like he understand your issue and I will come back to you

Read more comments on GitHub >

github_iconTop Results From Across the Web

There appears to be trouble with your network connection ...
this kind of error occurs when your net cannot access some package resource which yarn.lock file specified. check your yarn.lock file or delete ......
Read more >
yarn is having troubles with the network connection
Try clearing your cache $ yarn cache clean $ yarn // to install dependencies, no need for "yarn install". Approach 2
Read more >
Error Codes | Yarn - Package Manager
A list of Yarn's error codes with detailed explanations. ... The author of packageA can fix this problem by adding a peer dependency...
Read more >
How To Install and Use the Yarn Package Manager for Node.js
The yarn.lock file locks those dependencies to specific versions, making sure that the dependency tree is always consistent. Installing all of a ...
Read more >
Troubleshooting | React Navigation
To fix this, install the dependency in your project: npm; Yarn. npm install name-of-the-module
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found