Next.js Discord

Discord Forum

Vercel problem

Answered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
i can't reposite a site web
Answered by joulev
remove the "builds: [...] part, change "build" script to "build": "prisma generate && next build"
View full answer

15 Replies

Masai LionOP
PrismaClientInitializationError: Prisma has detected that this project was built on Vercel, 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.

Learn how: https://pris.ly/d/vercel-build
    at sl (/vercel/path0/node_modules/@prisma/client/runtime/library.js:164:69)
    at new t (/vercel/path0/node_modules/@prisma/client/runtime/library.js:177:3305)
    at 12164 (/vercel/path0/.next/server/app/(autre)/api/register/route.js:72:37)
    at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/vercel/path0/.next/server/app/(autre)/api/register/route.js:154:39)
    at /vercel/path0/.next/server/app/(autre)/api/register/route.js:155:70
    at __webpack_require__.X (/vercel/path0/.next/server/webpack-runtime.js:138:21)
    at /vercel/path0/.next/server/app/(autre)/api/register/route.js:155:47
    at Object.<anonymous> (/vercel/path0/.next/server/app/(autre)/api/register/route.js:158:3)
    at Module._compile (node:internal/modules/cjs/loader:1256:14) {
  clientVersion: '4.16.2',
  errorCode: undefined
}


> Build error occurred
Error: Failed to collect page data for /api/register
    at /vercel/path0/node_modules/next/dist/build/utils.js:1152:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1 
the error when i'm at this page
@Masai Lion PrismaClientInitializationError: Prisma has detected that this project was built on Vercel, 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. Learn how: https://pris.ly/d/vercel-build at sl (/vercel/path0/node_modules/@prisma/client/runtime/library.js:164:69) at new t (/vercel/path0/node_modules/@prisma/client/runtime/library.js:177:3305) at 12164 (/vercel/path0/.next/server/app/(autre)/api/register/route.js:72:37) at __webpack_require__ (/vercel/path0/.next/server/webpack-runtime.js:25:42) at __webpack_exec__ (/vercel/path0/.next/server/app/(autre)/api/register/route.js:154:39) at /vercel/path0/.next/server/app/(autre)/api/register/route.js:155:70 at __webpack_require__.X (/vercel/path0/.next/server/webpack-runtime.js:138:21) at /vercel/path0/.next/server/app/(autre)/api/register/route.js:155:47 at Object.<anonymous> (/vercel/path0/.next/server/app/(autre)/api/register/route.js:158:3) at Module._compile (node:internal/modules/cjs/loader:1256:14) { clientVersion: '4.16.2', errorCode: undefined } > Build error occurred Error: Failed to collect page data for /api/register at /vercel/path0/node_modules/next/dist/build/utils.js:1152:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { type: 'Error' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Error: Command "yarn run build" exited with 1
do exactly what it tells you to do: add the prisma generate step to the build process
how does your package.json look like
{
  "name": "familliale-site-next",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@auth/prisma-adapter": "^1.0.0",
    "@emailjs/browser": "^3.11.0",
    "@emotion/react": "^11.11.1",
    "@emotion/styled": "^11.11.0",
    "@heroicons/react": "^2.0.18",
    "@mui/material": "^5.13.7",
    "@prisma/client": "^4.16.2",
    "autoprefixer": "10.4.14",
    "bcrypt": "^5.1.0",
    "emailjs-com": "^3.2.0",
    "embla-carousel-autoplay": "^8.0.0-rc03",
    "embla-carousel-react": "^8.0.0-rc03",
    "eslint": "8.39.0",
    "eslint-config-next": "13.4.0",
    "keen-slider": "^6.8.5",
    "next": "^13.4.3",
    "next-auth": "^4.22.1",
    "postcss": "8.4.23",
    "prisma": "^4.16.2",
    "probe-image-size": "^7.2.3",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-icons": "^4.8.0",
    "react-intersection-observer": "^9.4.3",
    "react-spring-lightbox": "^1.7.1",
    "react-use-downloader": "^1.2.4",
    "sass": "^1.62.1",
    "styled-components": "^6.0.0-rc.1",
    "stylis": "^4.2.0",
    "tailwindcss": "3.3.2"
  },
  "devDependencies": {
    "@types/node": "20.3.3",
    "typescript": "5.1.6"
  },
  "builds": [
    {
      "src": "prisma generate && next build",
      "use": "@vercel/static-build"
    }
  ]
}
Answer
Masai LionOP
{
"name": "familliale-site-next",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "prisma generate && next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@auth/prisma-adapter": "^1.0.0",
"@emailjs/browser": "^3.11.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@heroicons/react": "^2.0.18",
"@mui/material": "^5.13.7",
"@prisma/client": "^4.16.2",
"autoprefixer": "10.4.14",
"bcrypt": "^5.1.0",
"emailjs-com": "^3.2.0",
"embla-carousel-autoplay": "^8.0.0-rc03",
"embla-carousel-react": "^8.0.0-rc03",
"eslint": "8.39.0",
"eslint-config-next": "13.4.0",
"keen-slider": "^6.8.5",
"next": "^13.4.3",
"next-auth": "^4.22.1",
"postcss": "8.4.23",
"prisma": "^4.16.2",
"probe-image-size": "^7.2.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.8.0",
"react-intersection-observer": "^9.4.3",
"react-spring-lightbox": "^1.7.1",
"react-use-downloader": "^1.2.4",
"sass": "^1.62.1",
"styled-components": "^6.0.0-rc.1",
"stylis": "^4.2.0",
"tailwindcss": "3.3.2"
},
"devDependencies": {
"@types/node": "20.3.3",
"typescript": "5.1.6"
},
]
}
like this ?
yes that should do
Masai LionOP
thx