Turborepo setup not working with prisma: Cannot find module `fs`
I have started to migrate my basic NextJs application to turborepo and am facing some issues with using prisma client. I have a nextJs app with trpc among others and we use mongodb. I have followed this link https://www.prisma.io/docs/guides/using-prisma-orm-with-turborepo but I see that while I am using this from the web app I see an error regarding the use of
fs
in the browser. Upon inspecting the generated/client/index.js file I see this code <attached screenshot>. Can anyone please help regarding this. My turbo version is 2.3.3 and Prisma is at 6.3.0How to use Prisma ORM with Turborepo | Prisma Documentation
Learn step-by-step how to integrate Prisma ORM with Turborepo to build modular, scalable monorepo architectures efficiently.


3 Replies
Howdy, friend! I'm the Prisma AI Help Bot — fast answers from me, or slow, hand-crafted wisdom from a dev? Choose wisely, adventurer.
It's likely that this issue would occur if PrismaClient is imported on the client side.
https://stackoverflow.com/questions/64926174/module-not-found-cant-resolve-fs-in-next-js-application
Can you ensure that PrismaClient is used only on server side?
Stack Overflow
Module not found: Can't resolve 'fs' in Next.js application
Unable to identify what's happening in my next.js app. As fs is a default file system module of nodejs. It is giving the error of module not found.
Thanks for replying. I'm importing Prisma types and enums in the client side and this is important in the context of the application. Can we not proceed without this?