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 ajv-keywords@3.5.2
npm ERR! peer dep missing: ajv@>=8, required by @apideck/better-ajv-errors@0.2.5

Solutions I tried with no effect -

Below graph shows how the two packages are loaded -

> npm ls @apideck/better-ajv-errors@0.2.5
`-- my-app@0.1.8
  `-- react-scripts@5.0.0-next.37
    `-- workbox-webpack-plugin@6.2.4
      `-- workbox-build@6.2.4
        `-- @apideck/better-ajv-errors@0.2.5

> npm ls ajv-keywords@3.5.2
+-- babel-loader@8.2.2
| `-- schema-utils@2.7.1
|   `-- ajv-keywords@3.5.2
+-- my-app@0.1.8
| `-- react-scripts@5.0.0-next.37
|   `-- react-dev-utils@12.0.0-next.37
|     `-- fork-ts-checker-webpack-plugin@6.0.5
|       `-- schema-utils@2.7.0
|         `-- ajv-keywords@3.5.2  deduped
`-- webpack@5.53.0
  `-- schema-utils@3.1.1
    `-- ajv-keywords@3.5.2  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