Error: Cannot find module 'ajv/dist/core'

See original GitHub issue

I’m getting Error: Cannot find module 'ajv/dist/core' when trying to require require('api'). It’s coming from the dependancy ajv-draft-04@1.0.0.

└─┬ api@4.2.0  
  └─┬ @readme/openapi-parser@2.0.3    
    └── ajv-draft-04@1.0.0 

api version 4.2.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
DashBarkHusscommented, Mar 18, 2022

Ok I switched to the same versions of node and npm as you. node v14.18.2 and npm 7.24.2 using nvm. But still had the issue

You were right it was the wrong version of AJV.

I ran $ npm ls ajv and got:

├─┬ api@4.2.0
│ └─┬ @readme/openapi-parser@2.0.3
│   └── UNMET PEER DEPENDENCY ajv@8.10.0 
└─┬ eslint@7.7.0
  ├── ajv@6.12.4 
  └─┬ table@5.4.6
    └── ajv@6.12.4  deduped
    
    npm ERR! peer dep missing: ajv@^8.5.0, required by ajv-draft-04@1.0.0

so I ran npm install ajv@8.10.0

Now it’s fixed . Thank you!

1reaction
erunioncommented, Mar 18, 2022

Also do you have AJV installed anywhere else with your codebase? Could be that a different version of AJV or ajv-draft-04 are trying to get loaded and they don’t have this dist/core file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'ajv/dist/compile/codegen' #875
When trying to run webpack build a project with min-css-extract-plugin, it failed. ... ajv-keywords@5.1.0 requires a peer of ajv@^8.8.2 but none ...
Read more >
Quasar Error: Cannot find module 'ajv/dist/compile/codegen'
I just hit the same error several times recently. In my case the error was based on ajv-keywords and ajv-formats plugin incompatibility with ......
Read more >
ajv-dist - npm
Start using ajv-dist in your project by running `npm i ajv-dist`. There are 4 other projects in the npm registry using ajv-dist.
Read more >
Cannot find module 'ajv/dist/core' #264 - bytemeta
Hello! It seems that there is a problem with a dependency of ajv, when using openapi-glue v2.6.1 it throws an error whenever I...
Read more >
Error: Cannot find module 'ajv/dist/compile/context' - Issuehunt
I'm getting the error "Error: Cannot find module 'ajv/dist/compile/context'" Using electron-store ^7.0.0 and up. Downgraded to 6.0.1 and everything worked ...
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