-
-
Notifications
You must be signed in to change notification settings - Fork 718
Description
Environment
- Operating System: Darwin
- Node Version: v24.7.0
- Nuxt Version: 3.19.2
- CLI Version: 3.28.0
- Nitro Version: 2.12.6
- Package Manager: [email protected]
- Builder: -
- User Config: compatibilityDate, app, ssr, typescript, css, vite, runtimeConfig, modules, content, image, i18n
- Runtime Modules: @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected], @pinia/[email protected], @nuxtjs/[email protected], @vueuse/[email protected], @nuxt/[email protected]
- Build Modules: -
Version
v3
Reproduction
Here are two reproductions. One vor Nuxt v4 and one for Nuxt v3. The bugs seems to appear in both.
Nuxt v4:
https://stackblitz.com/edit/github-7mycafuh?file=package.json
Nuxt v3:
https://stackblitz.com/edit/github-z1lduexc?file=package.json
Unfortunately in the reproduction the logs seems to be different. I added the log in my env to the Logs section.
Description
I wanted to upgrade to the latest version of Nuxt Content, which is currently v3.7.0. After upgrading the dependency and resolving all dependency conflicts I got the error that the module zod-to-json-schema
could not be found.
ERROR Cannot start nuxt: Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema'
Additional context
I quickly asked Claude about this problem and that was the answer. I do not know if this is really the issue but maybe the information helps.
Perfect! Now I can see exactly what's happening. Looking at the @nuxt/[email protected] package.json, there's a conflicting dependency declaration that's causing the issue:
The Problem
zod-to-json-schema is declared in three different ways:Regular dependency: "zod-to-json-schema": "^3.24.6"
Peer dependency: "zod-to-json-schema": "*"
Optional peer dependency: "zod-to-json-schema": { "optional": true }This conflicting declaration confuses pnpm's dependency resolution. When a package is both a regular dependency AND an optional peer dependency, pnpm may skip installing it, expecting the parent project to provide it.
Logs
ERROR Cannot start nuxt: Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema' 10:12:37 AM
Require stack:
- /Users/fscheffczyk/DevProjects/portfolio/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/content/dist/module.mjs
at loadNuxtModuleInstance (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/kit/dist/index.mjs:2721:15)
at async installModules (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/kit/dist/index.mjs:2562:17)
at async initNuxt (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_74487215975ecf3767e75103b8d129de/node_modules/nuxt/dist/index.mjs:5872:3)
at async NuxtDevServer._load (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/index.mjs:211:5)
at async NuxtDevServer.load (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/index.mjs:139:7)
at async NuxtDevServer.init (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/index.mjs:130:5)
at async initialize (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/index.mjs:429:3)
at async Object.run (node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/cli/dist/chunks/dev.mjs:135:43)
at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:445:7)