Migrationg to 7.0.0
We migrated to v7 from 6.19.0 and now we just get a TON of errors for ALL files
12 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
When migrating to Prisma v7, you may encounter errors like
Starting with Prisma v6.6.0, if you specify a custom output path for the Prisma Client in your
If you do not specify a custom output, you should continue to import from
If you use pnpm or a monorepo, ensure your generated client is accessible to all packages that need it, and consider using a postinstall script: This ensures the client is always generated after install, which can resolve many type errors see example. Summary:
Update your import paths to match your Prisma Client output location. If you use a custom output, import from that path. If n ot, ensure you have generated the client and are importing from
Module '"@prisma/client"' has no exported member 'FileType'.ts(2305) for all files. This is a common issue when upgrading major versions, especially if you use a custom output path for the Prisma Client or if your import paths are not updated to match the new structure.
Key points from the knowledge sources:
- Custom Output Path:Starting with Prisma v6.6.0, if you specify a custom output path for the Prisma Client in your
schema.prisma, you must import types and the client from that custom path, not from @prisma/client. For example, if your generator block is:
Then you should import like this:
Importing from @prisma/client will not work if you use a custom output path, as the types and client are not generated there anymore. This is a breaking change and is documented in the migration guides and issues see example.
- Default Output Path:If you do not specify a custom output, you should continue to import from
@prisma/client. If you see missing exports, ensure you have run prisma generate after upgrading, and that your IDE/TypeScript server is restarted to pick up the new types.
- Monorepo/Package Manager Issues:If you use pnpm or a monorepo, ensure your generated client is accessible to all packages that need it, and consider using a postinstall script: This ensures the client is always generated after install, which can resolve many type errors see example. Summary:
Update your import paths to match your Prisma Client output location. If you use a custom output, import from that path. If n ot, ensure you have generated the client and are importing from
@prisma/client. Restart your IDE/TS server after changes.
If you still have issues, double-check your schema.prisma generator block and your import statements.generator client {
provider = "prisma-client"
output = "../node_modules/.prisma/client"
}
datasource db {
provider = "mysql"
}
enum OrganizationType {
COMPANY
INDIVIDUAL
}
🤔 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.
Could you try changing your output path to somewhere outside the node_modules and changeyour imports to the new path and check?
We are also getting this issue. all the models are getting deleted and all the enums.
it doesnt seem to be working when models are defined in seperate files
having the models defined in schema.prisma rather than seperate files seems to work in v7, but this is ugly with a large number of models
it appears that
schema in prisma.config.ts needs to be set on the folder itself, rather than schema.prisma. this is different behavior in prisma 7. after changing that it works.
@Adde maybe you could try this because i also had that issueGot it to work but now, do we need to reexport ALL types? As we can no longer use @prisma/client in client only files, only for types right @Nurul
Generators (Reference) | Prisma Documentation
Generators in your Prisma schema specify what assets are generated when the
prisma generate command is invoked. This page explains how to configure generators.chiming in, you should be using the generated client for this
not the
@prisma/client package itselfWhere was that mentioned in the upgrade guide? That using @prisma/client is now deprecated. https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7
Adding in, it seems to be generating .ts files, but looking for .js files in
client.ts
client.ts
logs
Changing them manually to .ts in client.ts and it seems tow rokDid you figure it out? I have a tone of problem with migrating, I feel the upgrade guide are absolutley trash( Sorry)
also NextJS doesnt like "type": "module",
"The issue is that at runtime, Node.js is still trying to load from node_modules/.pnpm/@prisma/client/default.js, which expects
.prisma/client/default to exist."
Collecting page data .[Error: Cannot find module '.prisma/client/default'
@Nurul any idea?
@Nurul (Prisma) ? 🙂
Going through it right now
Prisma just infers the output type based on the weather and the time, so set the output type explicitly:
It's been mentioned for over a year. The whole roadmap for 2025, was to move gradually away from the rust based client (@prisma/client), instead favoring the TS native version, from the generated folder.
Also, why would you specify .js files?
In your build step, the generation should also convert the generated (.ts) files, to .js, so that they can be used at runtime.
I have not yet come across the need to do these:
So I suspect you may be doing something a bit unusual.
Maybe this reproduction (Prisma in a monorepo, with NextJS) is helpful to you?
https://github.com/aarhusgregersen/prisma-seed-minimal-reproduction/tree/feat/prisma-7
That is likely because you have
@prisma/client imports across your codebase still, is it not?
These should be converted to point to your generated output folder instead. The @prisma/client is effectively deprecated, when it comes to importing it within your codebase.
You do still need it in dependencies for now