[Bug?]: node-modules - Dependency with different major version in nested workspace not installed
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
I have two nested packages. The outer one depends on ESLint 7, the inner one on ESLint 8. Only ESLint 7 is installed.
To reproduce
const { writeFile } = require("fs").promises;
await packageJson({
private: true,
dependencies: {
eslint: "^7.0.0"
}
},{ cwd: "workspace" })
await packageJson({
private: true,
dependencies: {
eslint: "8.0.0-beta.2"
}
},{ cwd: "workspace/nested" })
await writeFile(".yarnrc.yml", `nodeLinker: node-modules`);
await writeFile("workspace/nested/index.js", `module.exports = require("eslint/package.json").version`);
await packageJsonAndInstall({
workspaces: ["workspace", "workspace/nested"]
});
const version = await node("workspace/nested/index.js");
expect(version).toBe("8.0.0-beta.2");
If this sherlock reproduction doesn’t work, you can clone this branch: https://github.com/nicolo-ribaudo/babel/tree/yarn-bug-missing-dep. The last commit shows the package necessary to introduce the bug; you can run node eslint/babel-eslint-parser/test/eslint-8/index.js and it should print 8.0.0-beta.2.
Environment
System:
OS: Linux 5.11 Ubuntu 21.04 (Hirsute Hippo)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Binaries:
Node: 16.8.0 - /tmp/xfs-cc5b8bc4/node
Yarn: 2.4.1-git.20210125.0f31e6910 - /tmp/xfs-cc5b8bc4/yarn
npm: 7.21.1 - ~/.npm-global/bin/npm
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How do I override nested NPM dependency versions?
When I do this, only the grunt-contrib-connect dependency and its children are installed. All my other dependencies in package.json are not installed. –...
Read more >npm-link
First, npm link in a package folder with no arguments will create a symlink in the global ... Only install direct dependencies in...
Read more >A story of how we migrated to pnpm - ‹div›RIOTS
We recently switched to pnpm, here's why and how.
Read more >The Case for Monorepos: A sane Workspace Setup (Part 2)
Used, but not installed dependencies: the opposite could be the case ... other packages in your monorepo (as direct or nested dependency).
Read more >Symlinked `node_modules` structure - PNPM
pnpm's node_modules layout uses symbolic links to create a nested structure of dependencies. Every file of every package inside node_modules is a hard...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@nicolo-ribaudo Just a heads up, I’ve took a stab to fix this issue at #3438, checked your example and it works for me now. Gotta add integration tests to the PR to prevent future regressions in the following days.
The problem is actually different. The
workspaces/nestedcopy is hoisted to the top-level, not to the parent workspace. Theeslintcopy in the parent workspace is correct. Looking…