How to install a peer dependency required by two different packages with different versioning?


(Yuping Zuo) #1

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

+-- eslint@5.2.0
| +-- ajv@6.5.2
| `-- table@4.0.3
|   +-- UNMET PEER DEPENDENCY ajv@6.5.2
|   `-- ajv-keywords@3.2.0
`-- snyk@1.89.0
  `-- snyk-docker-plugin@1.10.3
    `-- request@2.87.0
      `-- har-validator@5.0.3
        `-- UNMET DEPENDENCY ajv@5.5.2
npm ERR! peer dep missing: ajv@^6.0.0, required by ajv-keywords@3.2.0
npm ERR! missing: ajv@5.5.2, required by har-validator@5.0.3

Now, as you can see, I don’t think I can satisfy both ajv@5.5.2 and ajv@^6.0.0 at the same time, can I? How could I solve this issue?


(Yuping Zuo) #2

Ok, turns out that only ajv@^6.0.0 is a peer dependency. ajv@5.5.2 may be missing when I tried to install 6.0.0 and accidentally removed by npm. So I run npm update to get ajv@5.5.2 back, and then install ajv@6.0.0 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?


(system) #3

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.