1

My application depends on npm packages ajv-keywords & @apideck/better-ajv-errors which in turn are dependent on package ajv but of different versions as shown in below errors.

npm ERR! peer dep missing: ajv@^6.9.1, required by [email protected]
npm ERR! peer dep missing: ajv@>=8, required by @apideck/[email protected]

Solutions I tried with no effect -

Below graph shows how the two packages are loaded -

> npm ls @apideck/[email protected]
`-- [email protected]
  `-- [email protected]
    `-- [email protected]
      `-- [email protected]
        `-- @apideck/[email protected]

> npm ls [email protected]
+-- [email protected]
| `-- [email protected]
|   `-- [email protected]
+-- [email protected]
| `-- [email protected]
|   `-- [email protected]
|     `-- [email protected]
|       `-- [email protected]
|         `-- [email protected]  deduped
`-- [email protected]
  `-- [email protected]
    `-- [email protected]  deduped

Please suggest an appropriate solution to satisfy both the dependencies.

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142

1 Answers1

3

that's never a fun situation to be in, and can't say either npm nor yarn have ever managed solved this completely/cleanly.

Normally, you'd be stuck waiting for your dependencies to unpin, or upgrade their versions...

That said, not sure if you have a specific requirement to use an older version of ajv-keywords, but the latest ajv-keywords uses ajv v8.

updating your package.json with

"ajv-keywords": "^5.0.0"

and re-running npm install should get you there.

If in doubt, be sure to review their readme to verify the update doesn't imply any unexpected changes for you.

Nick Lloyd
  • 51
  • 6