question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with ajv package since upgrading to orval 6.6.1

See original GitHub issue

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)

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
yekvercommented, Feb 22, 2022

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

1reaction
mellowarecommented, Feb 17, 2022

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Doesnt work with ajv@8.8+ · Issue #46 · ajv-validator/ajv-formats
3 any higher version breaks the addFormats that do not accept the Ajv instance anymore. Do you plan an upgrade to support newest...
Read more >
Ajv: Another JSON Schema Validator - npm
Ajv generates code using doT templates to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization.
Read more >
ajv - NPM Package Overview - Socket.dev
Package uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that ...
Read more >
Changes from Ajv v6.12.6 to v8.0.0 - Ajv JSON schema validator
Ajv instance can only be created with new keyword, as Ajv is now ES6 class. browser bundles are automatically published to ajv-dist package...
Read more >
Ajv NPM | npm.io
Supports JSON Schema draft-04/06/07/2019-09/2020-12 (draft-04 support requires ajv-draft-04 package) and JSON Type Definition RFC8927. build npm downloads ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found