P
Prisma7mo ago
ajay

Cannot see the sql directory in node_modules/@prisma/client

1) I am using --sql flag for generating client 2) version is 6.5 3) no custom output directory, and sql folder is is in correct location But still cannot see the sql directory in node_modules/@prisma/client
4 Replies
Prisma AI Help
Prisma AI Help7mo ago
You opted for speed from this bot. Let's conjure up an answer right now! If you are using Prisma 6.5, the --sql flag, and have your sql folder in the correct location (e.g., prisma/sql), but do not see a sql directory in node_modules/@prisma/client, there may be a few things to check: 1. Default Output Location: With no custom output, the generated client and its sql directory should appear in node_modules/.prisma/client and be re-exported by node_modules/@prisma/client. The actual sql directory is not directly inside @prisma/client, but inside .prisma/client, and is accessed via the @prisma/client/sql import. This is expected behavior and matches the documented structure for TypedSQL usage. You should not expect to see a physical sql directory inside node_modules/@prisma/client itself, but rather in node_modules/.prisma/client/sql, which is referenced by the @prisma/client/sql entrypoint Getting started with TypedSQL. 2. Import Path: To use your generated SQL queries, you should import them like this:
import { getUsersWithPosts } from '@prisma/client/sql'

import { getUsersWithPosts } from '@prisma/client/sql'

This works because @prisma/client/sql points to the generated files in .prisma/client/sql. 3. Build/Deploy Issues: If you are deploying (e.g., with Docker), ensure that node_modules/.prisma is copied into your final image. Missing this step can cause runtime errors about missing sql modules Error: Cannot find module '.prisma/client/sql'. 4. Client Generation: Make sure you run prisma generate --sql after all migrations and that there are no errors during generation. If you still do not see the sql directory in node_modules/.prisma/client, or cannot import from @prisma/client/sql, there may be a bug or an environment-specific issue. The knowledge sources do not mention a change in this behavior for Prisma 6.5, so if the above steps do not resolve your issue, please provide more details or check for open issues with your exact version.
Nurul
Nurul7mo ago
Hey! Is your project open source? If yes, can you please share the link so that I can try to reproduce this error?
ajay
ajayOP7mo ago
@Nurul (Prisma)My bad; it was a different issue with the package re-export. I fixed it by directly importing the prisma client . thank you
Nurul
Nurul7mo ago
No worries! I am glad to hear that you were able to resolve it

Did you find this page helpful?