You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing this build error in "ajv-keywords" after installing packages with npm install --legacy-peer-deps Error: Cannot find module 'ajv/dist/compile/codegen'
babel-loader@^9.1.2 depends on schema-utils@^4.0.0 which further depends on :
ajv@^8.8.0 and ajv-keywords@^5.0.0, where ajv-keywords has a peer dependency on ajv@^8.8.0
Run npm install --legacy-peer-deps and notice the incorrect tree structure in node_modules i.e. [email protected]
gets hoisted on the root level of node_modules and is using incorrect version of [email protected].
This is a problem because the hoisted ajv-keywords@^5.0.0 will not have its peer dependency on ajv@^8.8.0 met.
Note: This works correctly on npm < 7
Possible solution: Can you please add "ajv" as your packages dependencies instead of devDependency? This will ensure "ajv-keywords" to get latest "ajv" version
**Environment**
npm: 8.19.4
Node.js: 18.15.0
OS Name: Mac OS
The text was updated successfully, but these errors were encountered:
developer-73
changed the title
Add "ajv" as its dependency instead of devDependency
Error: Cannot find module 'ajv/dist/compile/codegen'
Mar 30, 2023
GuiDevloper
added a commit
to GuiDevloper/nullstack-adapters
that referenced
this issue
Jun 9, 2023
Remove `ajv` npm dep fix for [this](ajv-validator/ajv-keywords#385) applied today because of TurboCLI used by StackBlitz. Reason: exactly today they deprecated it and opted in using native npm 🤡
In order to prevent this disagreement at the top level of node_modules, I have found that a workaround is to manually add dependencies on specific, agreeing versions of schema-utils, ajv and ajv-keywords.
So in your package.json under "dependencies" or "devDependencies", try adding either:
I am facing this build error in "ajv-keywords" after installing packages with
npm install --legacy-peer-deps
Error: Cannot find module 'ajv/dist/compile/codegen'
Background:
Consider the following dependency trees:
Notice: with
npm install --legacy-peer-deps
(1st tree) gives incorrect tree structure and not withnpm install
(2nd one).npm install --legacy-peer-deps
results in following error onnpm run build
:Error: Cannot find module 'ajv/dist/compile/codegen'
I have prepared a repo at https://github.com/developer-73/ajv-peerdep-issue.
I am using following devDependencies ::
"babel-loader": "9.1.2",
"eslint": "8.36.0"
ajv@^8.8.0 and ajv-keywords@^5.0.0, where ajv-keywords has a peer dependency on ajv@^8.8.0
Run
npm install --legacy-peer-deps
and notice the incorrect tree structure in node_modules i.e. [email protected]gets hoisted on the root level of node_modules and is using incorrect version of [email protected].
This is a problem because the hoisted ajv-keywords@^5.0.0 will not have its peer dependency on ajv@^8.8.0 met.
Note: This works correctly on npm < 7
Possible solution: Can you please add "ajv" as your packages dependencies instead of devDependency? This will ensure "ajv-keywords" to get latest "ajv" version
The text was updated successfully, but these errors were encountered: