Hey community,
I am stuck getting my machine run. I tried out various versions of my Dockerfile and included
‘RUN yarn prisma generate’,
but still the machine log at startup saying
‘Error: @prisma/client did not initialize yet. Please run “prisma generate” and try to import it again.’
Someone has an idea? Thanx in advance!
This is my Dockerfile:
WORKDIR /app
COPY package.json ./
COPY yarn.lock ./
COPY apps/server/package.json ./apps/server/package.json
RUN yarn
COPY /apps/server/prisma ./prisma/
RUN yarn prisma generate
COPY . .
RUN yarn build --filter=server
RUN rm -rf node_modules
RUN yarn --frozen-lockfile --prod
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/apps/server/dist ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
EXPOSE 8080
CMD ["node", "index.js"]
and this is part of the log:
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at Module.load (node:internal/modules/cjs/loader:1197:32)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at Module._load (node:internal/modules/cjs/loader:1013:12)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at Module.require (node:internal/modules/cjs/loader:1225:19)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at require (node:internal/modules/helpers:177:18)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at Object.<anonymous> (/app/src/modules/User/user.model.js:43:32)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] at Module._compile (node:internal/modules/cjs/loader:1356:14)
2023-12-04T09:31:57.426 app[e82d499c065058] ams [info] Node.js v18.19.0
2023-12-04T09:31:57.606 app[1781944a03d238] ams [info] INFO Starting init (commit: 15238e9)...
2023-12-04T09:31:57.628 app[1781944a03d238] ams [info] INFO Preparing to run: `docker-entrypoint.sh node index.js` as root
2023-12-04T09:31:57.637 app[1781944a03d238] ams [info] INFO [fly api proxy] listening at /.fly/api
2023-12-04T09:31:57.643 app[1781944a03d238] ams [info] 2023/12/04 09:31:57 listening on [fdaa:3:b9de:a7b:a356:cc7:9f29:2]:22 (DNS: [fdaa::3]:53)
2023-12-04T09:31:57.705 app[e82d499c065058] ams [info] INFO Main child exited normally with code: 1
2023-12-04T09:31:57.706 app[e82d499c065058] ams [info] INFO Starting clean up.
2023-12-04T09:31:57.708 app[e82d499c065058] ams [info] WARN hallpass exited, pid: 307, status: signal: 15 (SIGTERM)
2023-12-04T09:31:57.713 app[e82d499c065058] ams [info] 2023/12/04 09:31:57 listening on [fdaa:3:b9de:a7b:10d:3f4f:670a:2]:22 (DNS: [fdaa::3]:53)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] /app/node_modules/.prisma/client/index.js:43
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] throw new Error(
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] ^
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at new PrismaClient (/app/node_modules/.prisma/client/index.js:43:11)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Object.<anonymous> (/app/src/lib/prisma.js:4:14)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module._compile (node:internal/modules/cjs/loader:1356:14)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module.load (node:internal/modules/cjs/loader:1197:32)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module._load (node:internal/modules/cjs/loader:1013:12)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module.require (node:internal/modules/cjs/loader:1225:19)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at require (node:internal/modules/helpers:177:18)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Object.<anonymous> (/app/src/modules/User/user.model.js:43:32)
2023-12-04T09:31:58.181 app[1781944a03d238] ams [info] at Module._compile (node:internal/modules/cjs/loader:1356:14)