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.
Diogo ChagasPermalink
Oct 23
copy this generator client { provider = "prisma-client-js" } the -js make total difference, this solve my problem and then run npx prisma generate agains