#".prisma/client/default" is not a valid package
4 messages · Page 1 of 1 (latest)
This error comes from how Vite/Nitro resolve Prisma’s internal .prisma/* entrypoints – they treat them as bare package specifiers, which ESM rejects (".prisma/client/default" is not a valid package name).
From the knowledge sources, there are three patterns people use to fix similar errors:
1. Alias .prisma entrypoints to real files
For Vite-based setups, add a resolve.alias that points .prisma/* to the generated client files in node_modules/.prisma/client (or wherever your client is generated). [Vite alias fix; Edge alias example]
// vite.config.ts
import { defineConfig } from "vite";
import { fileURLToPath } from "node:url";
export default defineConfig({
// ...
resolve: {
alias: {
".prisma/client/default": "./node_modules/.prisma/client/default.js",
".prisma/client/index-browser":
"./node_modules/.prisma/client/index-browser.js",
".prisma/client/edge": "./node_modules/.prisma/client/edge.js",
},
},
});
If you’re on pnpm or a monorepo and the client isn’t in node_modules/.prisma/client, either:
- Change the Prisma generator output to that path:
generator client {
provider = "prisma-client-js"
output = "../node_modules/.prisma/client"
}
- Or adjust the alias paths to match your actual generated client location.
2. Avoid importing via .prisma/* directly
If you changed output in schema.prisma to a custom folder, make sure your imports match that path instead of relying on @prisma/client/.prisma/client or similar, which can also trigger “Invalid module .prisma” errors. [Nuxt output workaround]
3. Let Nitro treat Prisma as external instead of bundling it
For Nuxt/Nitro, people fixed related errors by marking `@prisma
/client` as an external dependency instead of fully bundling it. [Nuxt externals fix]
In your case you’re already using rollupOptions.external to exclude @prisma/client and .prisma/client. That’s good; the missing piece is usually the Vite alias above so that any remaining .prisma/client/* imports resolve to actual files instead of being treated as bare specifiers.
If after adding the alias you still see the error, the knowledge sources don’t provide a more specific Nitro/TanStack Start recipe; at that point I’d inspect where ".prisma/client/default" is being imported from and ensure it’s either:
- Resolved via alias to a concrete file, or
- Fully excluded from the Nitro bundle (externalized) so Node resolves it at runtime.
🤔 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.