😊
Prisma + NetlifyでPrismaClientInitializationErrorが出る時の対処法
環境
- Next13
- Prisma
- Netlify
状況
12:25:52 AM: PrismaClientInitializationError: Prisma has detected that this project was built on Netlify CI, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the `prisma generate` command during the build process.
12:25:52 AM: Learn how: https://pris.ly/d/netlify-build
12:25:52 AM: at Qs (/opt/build/repo/node_modules/@prisma/client/runtime/library.js:114:69)
12:25:52 AM: at new t (/opt/build/repo/node_modules/@prisma/client/runtime/library.js:126:2533)
12:25:52 AM: at 53538 (/opt/build/repo/.next/server/chunks/538.js:33:42)
12:25:52 AM: at __webpack_require__
結論
netlifyの実行コマンドを
npm run build
から、
npx prisma generate && npm run build
に変更する。
参考
Help
- netlify側のbuild errorは消えたが、デプロイ先がinternal 500になってしまう。。
- わかる方、助けてください
-
Discussion