Next.js build is failing

My Nextjs build keeps failing, although it works fine locally.

My error logging shows the following: Jun 22 05:07:47 PM > Build error occurred Jun 22 05:07:47 PM Error: > Build failed because of webpack errors Jun 22 05:07:47 PM at /opt/render/project/src/node_modules/next/dist/build/index.js:15:918 Jun 22 05:07:47 PM at runMicrotasks (<anonymous>) Jun 22 05:07:47 PM at processTicksAndRejections (internal/process/task_queues.js:95:5) Jun 22 05:07:47 PM at async /opt/render/project/src/node_modules/next/dist/build/tracer.js:1:1441 Jun 22 05:07:47 PM error Command failed with exit code 1. Jun 22 05:07:47 PM info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Jun 22 05:07:47 PM yarn run v1.22.18 Jun 22 05:07:47 PM $ /opt/render/project/src/node_modules/.bin/next export Jun 22 05:07:48 PM info - using build directory: /opt/render/project/src/.next Jun 22 05:07:48 PM Error: Could not find a production build in the '/opt/render/project/src/.next' directory. Try building your app with 'next build' before starting the static export. https://err.sh/vercel/next.js/next-export-no-build-id Jun 22 05:07:48 PM at /opt/render/project/src/node_modules/next/dist/export/index.js:3:958 Jun 22 05:07:48 PM at async /opt/render/project/src/node_modules/next/dist/build/tracer.js:1:1441 Jun 22 05:07:48 PM error Command failed with exit code 1. Jun 22 05:07:48 PM info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Jun 22 05:07:48 PM ==> Build failed 😞

Any ideas on what my issue is here?

Hi Jeremy,

Thanks for reaching out.

Those logs seem to suggest a resolution to the issue:

Error: Could not find a production build in the ‘/opt/render/project/src/.next’ directory. Try building your app with ‘next build’ before starting the static export.

If you’re still having trouble after that, please share as much detail as possible that can help us troubleshoot it with you, e.g. any further logs/errors/output, service ID, any reproduction steps, etc. If you don’t want to share these details on the community forum, please feel free to raise a ticket with support@render.com

Kind regards

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.