Error: cannot find module ‘.prisma/client/index’
Im having literally the same issue as this https://github.com/prisma/prisma/discussions/21422
Im running node 18, prisma 5.6.0
The only difference is that Im not using Vercel, but rather a self hosted kubernetes using rancher.
I can run the built docker image just fine, which I properly ran
prisma generate
, on WSL in my machine, but it have the error mentioned on rancher. Im completely clueless on what could cause such issue.GitHub
Error: Cannot find module '.prisma/client/index' · prisma prisma · ...
Bug description I am using smarterasp.net for deploying my next application. I have to zip entire app(including node_modules) and extract it. I referred following official guide- link I tried deplo...
4 Replies
Hi @Enzonaki 👋
The error
"cannot find module '.prisma/client/index'"
indicates that your code cannot locate the Prisma client library within the container running on Rancher.
Can you confirm that the prisma generate
command successfully completed and the .prisma/client
directory exists within your container running on Rancher from the logs?Yeah I downloaded the image, then ran it as a shell and confirmed the folder exists and all its contents with
ls -a
Its really weird, as if node is not finding the hidden folder?I think Node.js might not be including it in its default module search path by default because it's a hidden folder.
Can you try checking that the working directory where your application runs is set to the directory containing your project code in your docker file
i.e Set working directory to the project directory. For example
WORKDIR /app
Yeah its doing something like that
Like I said, the docker image itself is perfectly fine
I can download image, and using local docker/WSL I can start the application in the container with no issues
I just need to understand what could be possibly be different inside the kubernetes/Rancher that could make Node not find that hidden folder
Update just to leave a solution:
All I needed was the prisma folder (the one with the schema file) on the base folder of the workdir, and not inside dist
I have no idea why this matters while running inside kubernetes but it is what it is