orval: Problem with ajv package since upgrading to orval 6.6.1

During the npm install execution I’ve got these notifications:

npm WARN @stoplight/better-ajv-errors@1.0.1 requires a peer of ajv@>=8 but none is installed. You must install peer dependencies 
yourself.
npm WARN ajv-errors@3.0.0 requires a peer of ajv@^8.0.1 but none is installed. You must install peer dependencies yourself.

Execution of npx orval command fails with an error:

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'ajv/dist/compile/codegen'

Installing the ajv package didn’t fix the situation. I just got another error: Error compiling schema, function code: <LOTS_OF_CODE_HERE>

        throw e;
        ^

SyntaxError: Unexpected token ':'
    at new Function (<anonymous>)
    at Ajv.compileSchema (node_modules\@stoplight\spectral-core\node_modules\ajv\dist\compile\index.js:89:30)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (14 by maintainers)

Commits related to this issue

Most upvoted comments

JFYI: running npm i -D ajv && npm dedupe fixes the problem

In your project or just trying to compile Orval ? Orval uses yarn not npm.

However I am using Orval 6.6.1 in my npm project without issue?