The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
How to install a peer dependency required by two different packages with different versioning?
I have both eslint and snyk as dev dependencies in my package. Now after update, they both require ajv as a peer dependency, but with different versions required. Dependency graph (simplified):
+-- email@example.com | +-- firstname.lastname@example.org | `-- email@example.com | +-- UNMET PEER DEPENDENCY firstname.lastname@example.org | `-- email@example.com `-- firstname.lastname@example.org `-- email@example.com `-- firstname.lastname@example.org `-- email@example.com `-- UNMET DEPENDENCY firstname.lastname@example.org npm ERR! peer dep missing: ajv@^6.0.0, required by email@example.com npm ERR! missing: firstname.lastname@example.org, required by email@example.com
Now, as you can see, I don’t think I can satisfy both firstname.lastname@example.org and ajv@^6.0.0 at the same time, can I? How could I solve this issue?
Ok, turns out that only ajv@^6.0.0 is a peer dependency. email@example.com may be missing when I tried to install 6.0.0 and accidentally removed by npm. So I run npm update to get firstname.lastname@example.org back, and then install email@example.com as peer dependency. It seems to work now.
But still, I wonder what happens if people really face the issue, when two different version of a same peer dependency is required?