Skip to content

fix: add ajv@^8.20.0 to devDependencies to resolve npm run dev crash#60

Open
YASHMAHAKAL wants to merge 1 commit intolayer5io:masterfrom
YASHMAHAKAL:ajv
Open

fix: add ajv@^8.20.0 to devDependencies to resolve npm run dev crash#60
YASHMAHAKAL wants to merge 1 commit intolayer5io:masterfrom
YASHMAHAKAL:ajv

Conversation

@YASHMAHAKAL
Copy link
Copy Markdown
Contributor

@YASHMAHAKAL YASHMAHAKAL commented May 9, 2026

Problem

npm run dev fails out of the box with:

[webpack-cli] Error: Cannot find module 'ajv/dist/compile/codegen'

Root Cause

Two devDependencies pull conflicting versions of ajv into the tree:

  • eslint@10.x requires ajv@^6.x → gets hoisted to top-level node_modules/ajv
  • webpack / webpack-dev-serverschema-utils@4.xajv-keywords@5.x → peer requires ajv@^8.x

ajv-keywords@5.x is hoisted to the top level and resolves ajv from node_modules/ajv — which is v6. The path ajv/dist/compile/codegen does not exist in v6, causing the crash.

Fix

Add ajv@^8.20.0 to devDependencies. npm hoists v8 to the top level (direct dep wins), ajv-keywords finds v8 there and works. ESLint gets its own nested v6 copy at node_modules/eslint/node_modules/ajv and is unaffected.

ajv is placed in devDependencies and not dependencies because it has no relation to what this library exports — it is purely a dev toolchain version pin. Library consumers should not inherit it.

Testing

  • npm run dev starts without error ✅
  • npm run build passes ✅
  • npm test 234/234 pass ✅

Signed commits

  • Yes, I signed my commits.

Signed-off-by: YASHMAHAKAL <yvsst01@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant