N
Nuxt3mo ago
Dialoge

ERROR Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema'

ERROR Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema'
3 Replies
kapa.ai
kapa.ai3mo ago
Hi @Cordobes. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message:
ERROR Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema'
ERROR Error while importing module @nuxt/content: Error: Cannot find module 'zod-to-json-schema'
means that the zod-to-json-schema package is missing from your project. According to the Nuxt Content documentation, if you are using Zod v3 as your schema validator, you must install both zod and zod-to-json-schema as development dependencies:
npm i -D zod zod-to-json-schema
# or
pnpm add -D zod zod-to-json-schema
npm i -D zod zod-to-json-schema
# or
pnpm add -D zod zod-to-json-schema
If you are using Zod v4, you only need to install zod because Zod v4 provides native JSON Schema export and does not require zod-to-json-schema:
npm i -D zod
# or
pnpm add -D zod
npm i -D zod
# or
pnpm add -D zod
Make sure your content.config.ts is using the correct import for your Zod version. For Zod v3, you can import z from zod. For Zod v4, import from zod/v4 as shown in the documentation. Summary:
Install the missing package with your package manager, or upgrade to Zod v4 and update your imports to avoid needing zod-to-json-schema if you prefer a simpler setup.
See the official documentation for details. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@1275808916168511508> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
owljacob
owljacob3mo ago
GitHub
Release v3.7.0 · nuxt/content
🎉 Highlights Support multiple validator libraries Zod v4 and Valibot Collection fields can inherit their schema from Vue components NoteThe z re-export from @nuxt/content is deprecated and will b...

Did you find this page helpful?