Michael Jay
08/04/2022, 1:52 PM@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
I think this is happening because the prisma generate
must be run before npm install
. Of course, npm install is what installs prisma in the first place. I spun up a new Nest project and tried npx prisma generate
before installing Prisma. That doesn't throw an error - it results in:
Need to install the following packages:
prisma
Ok to proceed? (y)
So I think maybe my container is ignoring that command prompt (naturally), then trying to run npm install before prisma generate is run.
Does this sound like I'm on the right track? The next thing I'm going to try is installing prisma directly, THEN running prisma generate && npm install.
FROM node:16.15.1-alpine AS development
WORKDIR /usr/src/app
COPY package*.json ./
COPY . .
RUN npx prisma generate && npm install
RUN npm run build
FROM node:16.15.1-alpine AS production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
RUN npx prisma generate && npm install --production
COPY . .
COPY --from=development /usr/src/app/dist ./dist
CMD ["node", "dist/main"]
Lloyd Richards
08/04/2022, 2:45 PMprisma generate
after running any npm install
Michael Jay
08/04/2022, 3:07 PMMichael Jay
08/04/2022, 3:09 PMLloyd Richards
08/04/2022, 3:20 PMMichael Jay
08/04/2022, 3:27 PM