I believe I understand what "unmet peer dependency" means. For example "package-a" depends on "package-b@^2.1.5" but no version of [email protected] (>=2.1.5) is installed.
But "incorrect dependency" baffles me. It would make no sense to say "package-a is asking for an incorrect dependency". Is it saying that the dependency listed in package-lock.json or yarn.lock doesn't match what package-a says it needs? If this is correct, then how would this be resolved?
When I search for specific discussion about "incorrect dependency" on Github, it seems to show up on issues in the yarn or npm repos. And the resolution usually seems to be a fix to yarn or npm. Is this message for bugs in yarn/npm?
If I search https://docs.npmjs.com/ for "incorrect peer dependency", I get no results.
UNMET PEER DEPENDENCY error is thrown when the dependencies of one or more modules specified in the package. json file is not met. Check the warnings carefully and update the package. json file with correct versions of dependencies.
A peer dependency specifies that our package is compatible with a particular version of an npm package. If a package doesn't already exist in the node_modules directory, then it is automatically added. As you install a package, npm will automatically install the dev dependencies.
Usage. Run npm install (or yarn install ) to install prod and dev , as well as peer dependencies. You still may see "unmet peer dependency" warnings, due to installation flow of npm/yarn. Also it won't update lock (shrinkwrap) files or modify package.
Given these package.json
{
name: "app"
dependencies: {
"package-a": "*"
}
}
{
name: "package-a",
peerDependencies: {
"package-b": "^2.1.5"
}
}
A yarn install
will give you an unmet peer dependency, since app does not make sure package-b
gets installed.
If you add it as a dependency, but in a wrong version
{
name: "app"
dependencies: {
"package-a": "*",
"package-b": "~2.0.0"
}
}
you will get an incorrect peer dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With