PrismaClient does not exist on @prisma/client error

I have used this method to gen client forever but am getting this error for the first time
No description
2 Replies
Prisma AI Help
Prisma AI Help3mo ago
You selected the bot's instantaneous insights. Let me compile your answer right away! It usually comes down to one of these causes: 1) Prisma Client not generated (or generated to a custom location) - Run: npx prisma generate and check the output says “Generated Prisma Client … to ./node_modules/@prisma/client” (or your custom output). [Error @prisma/client did not initialize] - If you use a custom generator output, your imports must match it. Many tools (Nuxt module, etc.) expect the default @prisma/client path; removing custom output fixes initialization/import issues. [Nuxt module troubleshooting; Also reported] 2) Package hoisting / resolver issues (Nuxt/Vite/pnpm) - For Nuxt: add a Vite alias so index-browser resolves correctly: - '.prisma/client/index-browser': './node_modules/.prisma/client/index-browser.js' This resolves “Failed to resolve module specifier .prisma/client/index-browser” and related import problems. [Nuxt module troubleshooting] - With pnpm + Studio/browser imports, hoist prisma deps via .npmrc: hoist-pattern[]=prisma. [Nuxt module troubleshooting] 3) Version mismatch between prisma and @prisma/client - Ensure prisma and @prisma/client versions match; reinstall if needed. Users fixed init/import errors by removing node_modules + lockfile and reinstalling. [Did not initialize yet] 4) Workspace/custom output gotcha - If you set generator output to node_modules/.prisma/c lient or elsewhere, ensure your import path matches, or remove the custom output and import from @prisma/client. [Did not initialize yet; Nuxt module troubleshooting] 5) Environment/build system using wrong entry (Nuxt/Vercel) - Some Nuxt/Vercel setups required an alias to @prisma/client/index-browser (not .prisma path). [Issue 18272] Quick checklist: - npx prisma generate succeeds, no errors, correct path. - prisma and @prisma/client versions match. - Remove generator output and import: import { PrismaClient } from '@prisma/client'. - In Nuxt: add the Vite alias above. - Clean install: delete node_modules and lockfile, reinstall. If you still see “PrismaClient does not exist/is not exported,” please share: - Your generator block, import line, package manager, and exact generate output. [Module has no exported member; Could not resolve @prisma/client] 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
Nurul
Nurul2mo ago
Have you generated PrismaClient at a custom path? If yes, you would need to import it from the path you have specified.

Did you find this page helpful?