Technical questionAccepted answer
@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again
Rafiq
May 29
0 views1
I am using prisma, postgres, docker, kubernets.
npx prisma migrate dev working.
and npx prisma generate produce below output:
✔ Generated Prisma Client (2.23.0) to ./node_modules/@prisma/client in 68ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
but when I tried to use in my route file produce the error:
new-route.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
my docker file:
FROM node:alpine
WORKDIR /app
COPY package.json .
RUN npm install --only=prod
COPY . .
CMD ["npm", "start"]
1 answer
Accepted answer · original discussion
Rômulo Bourget Novas
PermalinkMay 29
I usually don't use docker for this while developing, but I have this issue every time I change something in my schema.prisma and have to use npx prisma generate. The solution for me is to restart the node application running npm start again. Maybe if you restart your containers it might work.
if you are inside kubernets pod then access the pod using terminal then give generate command
kubectl exec -it pod_name sh
npx prisma generate
3 question comments
Use comments to ask for clarification. Post a solution as an answer.
SakoBuPermalink
Mar 23
I think if you copy
COPY prisma ./prisma/ that should work. But I'm a few steps behind you as I can't get the npx prisma migrate dev to work with the error message: Error: P1001: Can't reach database server at auth-postgres-srv.default.svc.cluster.local:5432Haroon RamayPermalink
Oct 12
Just wanted to add my 2 cents to this. Recently spent half a day trying to figure out why my schema changes weren't being reflected when calling Prisma service. Turns out I had to restart the node environment or as I like to do it just restart the whole IDE and voila the changes start reflecting.