Netlify Module not found in remote, but works locally
Unanswered
Sphynx posted this in #help-forum
SphynxOP
Hi, I currently have a nextjs netlify build that keeps failing in remote but works whenever I run
Build Versions:
netlify build locally. These are weird errors to me as I haven't encountered this issue before, and everything is working except in remote netlify. 2:52:15 PM: Creating an optimized production build ...
2:52:24 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
2:52:24 PM: Failed to compile.
2:52:24 PM:
2:52:24 PM: Module not found: Can"t resolve "@/components/ShortVideo"
2:52:24 PM: https://nextjs.org/docs/messages/module-not-found
2:52:24 PM: ./src/app/clips/page.tsx
2:52:24 PM: Module not found: Can"t resolve "@/components/ui/button"
2:52:24 PM: https://nextjs.org/docs/messages/module-not-found
2:52:24 PM: ./src/app/dashboard/page.tsx
2:52:24 PM: > Build failed because of webpack errors
2:52:24 PM:  ELIFECYCLE  Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
2:52:24 PM: ​
2:52:24 PM: "build.command" failed Build Versions:
2:52:12 PM: ⯠Version
2:52:12 PM: @netlify/build 29.35.1
2:52:13 PM: ⯠Current directory
2:52:13 PM: /opt/build/repo
2:52:13 PM: ​
2:52:13 PM: ⯠Config file
2:52:13 PM: No config file was defined: using default values.
2:52:13 PM: ​
2:52:13 PM: ⯠Context
2:52:13 PM: deploy-preview
2:52:13 PM: ​
2:52:13 PM: ⯠Using Next.js Runtime - v4.41.3
2:52:14 PM: ​
2:52:14 PM: @netlify/plugin-nextjs (onPreBuild event)
2:52:14 PM: ────────────────────────────────────────────────────────────────
2:52:14 PM: ​
2:52:14 PM: Next.js cache restored.
2:52:14 PM: ​
2:52:14 PM: (@netlify/plugin-nextjs onPreBuild completed in 325ms)
2:52:14 PM: ​
2:52:14 PM: Build command from Netlify app
2:52:14 PM: ────────────────────────────────────────────────────────────────
2:52:14 PM: ​
2:52:14 PM: $ pnpm run build
2:52:15 PM: > spaceclips-frontend@0.1.0 build /opt/build/repo
2:52:15 PM: > next build
2:52:15 PM: â–² Next.js 14.0.4