I'm confused by the "Some peer dependencies are incorrectly met by your project" message #6746
Replies: 1 comment 2 replies
-
So, at one point, the peer dependency warning system wasn't as rigorous as it is now and would miss stuff that should be reported. A lot of those cases got fixed in 4.3. One of the cases that got fixed is this: {
"name": "@my/package",
"devDependencies": {
"@babel/preset-env": "^7.26.9"
},
"peerDependencies": {
"@babel/core": "*"
}
} Imagine this is the only workspace of a project. It would "provide" Even in a monorepo, each workspace is, on its own, the root of a dependency tree. This is true even if it is not the root workspace or if another workspace explicitly declares a dependency on it, because there are situations (e.g. running a script from it) where it is the dependency tree root. Back to your case, there are a number of things to discuss:
It is an unfortunate case of "damned if you do, damned if you don't". If you don't declare the dev dependencies, Yarn will see that As far as I understand, if there is a single version of Unless someone has a better idea, I think this is your best workaround under |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In yarn 4.2.2 this worked. I came across it while trying to update to 4.8.1.
Here's an example showcasing the behaviour ready to be installed locally https://github.com/snowystinger/yarn-peer-test
I'm posting the same structure outline here for reference.
Then I will get the error:
but package-a IS providing the peer, it has its own peer dependency on react
Have I missed something here? Surely I don't need to add a devDependency for every instance of this? if I do that, then I get node_modules installed in every package and I actually end up with multiple copies and different versions of react/react-dom.
Beta Was this translation helpful? Give feedback.
All reactions