-
SummaryHi all, just trying to learn a bit of next js but getting stuck on the build step, any suggestions here would be awesome. Have been trying fixes for the last 2 hours. Additional information[09:52:51.125] Running build in Washington, D.C., USA (East) – iad1
[09:52:51.275] Cloning github.com/mattybj69/nextjs-dashboard (Branch: main, Commit: ebdc8bd)
[09:52:51.407] Previous build caches not available
[09:52:51.710] Cloning completed: 436.000ms
[09:52:52.051] Running "vercel build"
[09:52:52.617] Vercel CLI 41.2.2
[09:52:53.067] Detected `pnpm-lock.yaml` 9 which may be generated by pnpm@9.x or pnpm@10.x
[09:52:53.068] Using pnpm@10.x based on project creation date
[09:52:53.069] To use pnpm@9.x, manually opt in using corepack (https://vercel.com/docs/deployments/configure-a-build#corepack)
[09:52:53.088] Installing dependencies...
[09:52:53.983] Lockfile is up to date, resolution step is skipped
[09:52:54.048] Progress: resolved 1, reused 0, downloaded 0, added 0
[09:52:54.079] Packages: +212
[09:52:54.079] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[09:52:55.050] Progress: resolved 212, reused 0, downloaded 28, added 12
[09:52:56.050] Progress: resolved 212, reused 0, downloaded 148, added 138
[09:52:57.051] Progress: resolved 212, reused 0, downloaded 175, added 162
[09:52:58.292] Progress: resolved 212, reused 0, downloaded 176, added 162
[09:52:59.293] Progress: resolved 212, reused 0, downloaded 177, added 166
[09:53:00.294] Progress: resolved 212, reused 0, downloaded 178, added 166
[09:53:01.293] Progress: resolved 212, reused 0, downloaded 191, added 175
[09:53:02.294] Progress: resolved 212, reused 0, downloaded 194, added 178
[09:53:03.295] Progress: resolved 212, reused 0, downloaded 206, added 190
[09:53:03.544] Progress: resolved 212, reused 0, downloaded 212, added 212, done
[09:53:03.709]
[09:53:03.710] dependencies:
[09:53:03.710] + @heroicons/react 2.2.0
[09:53:03.710] + @tailwindcss/forms 0.5.10
[09:53:03.710] + autoprefixer 10.4.20
[09:53:03.710] + bcrypt 5.1.1
[09:53:03.710] + clsx 2.1.1
[09:53:03.710] + next 15.1.6
[09:53:03.710] + next-auth 5.0.0-beta.25
[09:53:03.711] + postcss 8.5.1
[09:53:03.711] + postgres 3.4.5
[09:53:03.711] + react 19.0.0
[09:53:03.711] + react-dom 19.0.0
[09:53:03.712] + tailwindcss 3.4.17
[09:53:03.712] + typescript 5.7.3
[09:53:03.712] + use-debounce 10.0.4
[09:53:03.712] + zod 3.24.1
[09:53:03.712]
[09:53:03.713] devDependencies:
[09:53:03.713] + @types/bcrypt 5.0.2
[09:53:03.713] + @types/node 22.10.7
[09:53:03.713] + @types/react 19.0.7
[09:53:03.713] + @types/react-dom 19.0.3
[09:53:03.713]
[09:53:03.713] ╭ Warning ─────────────────────────────────────────────────────────────────────╮│ ││ Ignored build scripts: bcrypt, sharp. ││ Run "pnpm approve-builds" to pick which dependencies should be allowed ││ to run scripts. ││ │╰──────────────────────────────────────────────────────────────────────────────╯
[09:53:03.713]
[09:53:03.732] Done in 10.5s using pnpm v10.5.2
[09:53:03.766] Detected Next.js version: 15.1.6
[09:53:03.773] Running "pnpm run build"
[09:53:04.091]
[09:53:04.092] > @ build /vercel/path0
[09:53:04.092] > next build
[09:53:04.092]
[09:53:04.772] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[09:53:04.773] This information is used to shape Next.js' roadmap and prioritize features.
[09:53:04.773] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[09:53:04.774] https://nextjs.org/telemetry
[09:53:04.774]
[09:53:04.875] ▲ Next.js 15.1.6
[09:53:04.875] - Environments: .env
[09:53:04.875]
[09:53:04.900] Creating an optimized production build ...
[09:53:16.564] ✓ Compiled successfully
[09:53:16.569] Linting and checking validity of types ...
[09:53:21.153] Collecting page data ...
[09:53:21.581] [Error: Cannot find module '/vercel/path0/node_modules/.pnpm/bcrypt@5.1.1/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node'
[09:53:21.586] Require stack:
[09:53:21.592] - /vercel/path0/node_modules/.pnpm/bcrypt@5.1.1/node_modules/bcrypt/bcrypt.js
[09:53:21.595] - /vercel/path0/.next/server/app/seed/route.js
[09:53:21.595] - /vercel/path0/node_modules/.pnpm/next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/next/dist/server/require.js
[09:53:21.596] - /vercel/path0/node_modules/.pnpm/next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/next/dist/server/load-components.js
[09:53:21.596] - /vercel/path0/node_modules/.pnpm/next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/next/dist/build/utils.js
[09:53:21.600] - /vercel/path0/node_modules/.pnpm/next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/next/dist/build/worker.js
[09:53:21.600] - /vercel/path0/node_modules/.pnpm/next@15.1.6_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/next/dist/compiled/jest-worker/processChild.js] {
[09:53:21.602] code: 'MODULE_NOT_FOUND',
[09:53:21.602] requireStack: [Array]
[09:53:21.602] }
[09:53:21.603]
[09:53:21.603] > Build error occurred
[09:53:21.605] [Error: Failed to collect page data for /seed] { type: 'Error' }
[09:53:21.617] ELIFECYCLE Command failed with exit code 1.
[09:53:21.640] Error: Command "pnpm run build" exited with 1
[09:53:21.946] ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 20 replies
-
I think, you can first try to get bcrypt working a bit more, or switch to bcryptjs instead. What Node.js version do you use in the Vercel Deployment? |
Beta Was this translation helpful? Give feedback.
-
Hi, I had the same problem, but I was able to build by switching to pnpm remove bcrypt
pnpm add bcryptjs Don't forget to change /app/seed/route.ts to // /app/seed/route.ts
- import bcrypt from "bcrypt";
+ import bcrypt from "bcryptjs"; |
Beta Was this translation helpful? Give feedback.
-
Haha, a lot nextjs learners converged here. |
Beta Was this translation helpful? Give feedback.
-
In my case pnpm install was giving: ╭ Warning ───────────────────────────────────────────────────────────────────────────────────╮ So I executed "pnpm approve-builds", selected both and "pnpm run build" worked as expected without replacing bcrypt with bcryptjs In case you did try strange things before and is nervios, you can try to remove node_modules with |
Beta Was this translation helpful? Give feedback.
Hi, I had the same problem, but I was able to build by switching to
bcryptjs
as Joseph suggested.Don't forget to change /app/seed/route.ts to
bcryptjs
, as it usesbcrypt
.