blitz-js / blitz

⚡️ The Missing Fullstack Toolkit for Next.js

Home Page:https://Blitzjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module not found: Can't resolve 'ajv/dist/compile/codegen'

TechDufus opened this issue · comments

What is the problem?

Upon generating a new project scaffolding, running dev gives this error:

Loaded env from /app/home/techdufus/.code/my-project/.env.local
Loaded env from /app/home/techdufus/.code/my-project/.env
✔ Next.js was successfully patched with a React Suspense fix
✔ Routes manifest was successfully generated
  ▲ Next.js 13.5.4
  - Local:        http://localhost:3000
  - Environments: .env.local, .env
  - Experiments (use at your own risk):
     · typedRoutes

 ✓ Ready in 1783ms
 ○ Compiling /page ...
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.

Paste all your error logs here:

Loaded env from /app/home/techdufus/.code/my-project/.env.local
Loaded env from /app/home/techdufus/.code/my-project/.env
✔ Next.js was successfully patched with a React Suspense fix
✔ Routes manifest was successfully generated
  ▲ Next.js 13.5.4
  - Local:        http://localhost:3000
  - Environments: .env.local, .env
  - Experiments (use at your own risk):
     · typedRoutes

 ✓ Ready in 1783ms
 ○ Compiling /page ...
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⨯ ./node_modules/ajv-keywords/dist/definitions/_util.js:4:0
Module not found: Can't resolve 'ajv/dist/compile/codegen'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/ajv-keywords/dist/definitions/regexp.js
./node_modules/ajv-keywords/dist/keywords/regexp.js
./node_modules/ajv-keywords/dist/keywords/index.js
./node_modules/ajv-keywords/dist/index.js
./node_modules/schema-utils/dist/validate.js
./node_modules/schema-utils/dist/index.js
./node_modules/copy-webpack-plugin/dist/index.js
./node_modules/@blitzjs/next/dist/index-server.cjs
./src/app/blitz-client.ts
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.

Paste all relevant code snippets here:

PASTE_HERE (leave the ``` marks)

What are detailed steps to reproduce this?

  1. nvm use --lts #node v20.11.0
  2. blitz new my-project #App Router, Install deps Y, React Hook Form
  3. npm run dev

Run blitz -v and paste the output here:

Blitz version: 2.0.3 (global)
Blitz version: 2.0.3 (local)
Linux 5.15 | linux-x64 | Node: v20.11.0


 Package manager: npm

  System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (2) x64 Intel(R) Xeon(R) Platinum 8280 CPU @ 2.70GHz
    Memory: 1.98 GB / 7.75 GB
    Shell: 5.1.16 - /usr/bin/bash
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    Yarn: Not Found
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.3 => 2.0.3
    @blitzjs/next: 2.0.3 => 2.0.3
    @blitzjs/rpc: 2.0.3 => 2.0.3
    @prisma/client: 5.4.2 => 5.4.2
    blitz: 2.0.3 => 2.0.3
    next: 13.5.4 => 13.5.4
    prisma: 5.4.2 => 5.4.2
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    typescript: ^4.8.4 => 4.9.5

Please include below any other applicable logs and screenshots that show your problem:

No response

Odd, I removed husky and all lint packages and this seems to be resolved.

git diff package.json

diff --git a/package.json b/package.json
index 07c3100..8ae4883 100644
--- a/package.json
+++ b/package.json
@@ -7,10 +7,8 @@
     "build": "blitz build",
     "start": "blitz start",
     "studio": "blitz prisma studio",
-    "lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
     "test": "vitest run --passWithNoTests",
-    "test:watch": "vitest",
-    "prepare": "husky install"
+    "test:watch": "vitest"
   },
   "prisma": {
     "schema": "db/schema.prisma"
@@ -19,15 +17,12 @@
     "semi": false,
     "printWidth": 100
   },
-  "lint-staged": {
-    "*.{js,ts,tsx}": [
-      "eslint --fix"
-    ]
-  },
   "dependencies": {
     "@blitzjs/auth": "2.0.3",
     "@blitzjs/next": "2.0.3",
     "@blitzjs/rpc": "2.0.3",
+    "@hookform/error-message": "2.0.1",
+    "@hookform/resolvers": "2.9.11",
     "@prisma/client": "5.4.2",
     "blitz": "2.0.3",
     "formik": "2.4.5",
@@ -35,11 +30,9 @@
     "prisma": "5.4.2",
     "react": "18.2.0",
     "react-dom": "18.2.0",
-    "secure-password": "4.0.0",
-    "zod": "3.22.4",
     "react-hook-form": "7.50.0",
-    "@hookform/resolvers": "2.9.11",
-    "@hookform/error-message": "2.0.1"
+    "secure-password": "4.0.0",
+    "zod": "3.22.4"
   },
   "devDependencies": {
     "@next/env": "13.4.19",
@@ -51,12 +44,7 @@
     "@types/react": "18.0.25",
     "@typescript-eslint/eslint-plugin": "5.42.1",
     "@vitejs/plugin-react": "2.2.0",
-    "eslint": "8.27.0",
-    "eslint-config-next": "12.3.1",
-    "eslint-config-prettier": "8.5.0",
-    "husky": "8.0.2",
     "jsdom": "20.0.3",
-    "lint-staged": "13.0.3",
     "prettier": "^2.7.1",
     "prettier-plugin-prisma": "4.4.0",
     "pretty-quick": "3.1.3",