published fresh until

Next.js: Could not find a production build?

Summary As of October 2026, run next build before next start for a production server, or next dev for development. With output: export, serve the generated static files instead; the official runtime error names npx serve@latest out. Official docs and canary source checked 2026-10-28.

Not for builds failing only on Vercel, see build-passes-locally-fails-on-vercel-compare-node-version-and-logs

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Error: Could not find a production build in the '<resolved distDir>' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id

Next.js cannot start the production server, or rejects that server command for a static export.

First run the app's installed next build for a production-server app; inspect output: 'export' before trying next start again.

Evidence establishes the build prerequisite and the static-export command mismatch; public reports show both symptoms, but no app deployment was tested here.

Not for: Next.js builds that pass locally and fail on Vercel; see build-passes-locally-fails-on-vercel-compare-node-version-and-logs.

Diagnostic: "next start" does not work with "output: export"

Error: "next start" does not work with "output: export" configuration. Use "npx serve@latest out" instead.

How to choose the right command

1. Read the app's scripts and Next.js configuration. Decide whether the intended output is a production server or static files before changing commands. 2. For a production server, run next build to completion, then next start, using the installed commands through your existing scripts. The official error guide requires a production build before starting; for development it prescribes next dev instead (checked 2026-10-28). If the build itself fails, resolve that failure before retrying startup. 3. If a completed build still produces the missing-build error, inspect the configured output directory and whether build and start use the same app directory and artifact. This is a diagnostic check: the official server source reads the build ID from its configured distribution directory. Do not fabricate a build ID file. 4. For output: 'export', run next build and serve the generated static output. The official static-export guide documents out by default and allows a changed output directory. The runtime source explicitly directs npx serve@latest out for the default path (checked 2026-10-28). For deployment, use a web server that serves the generated HTML/CSS/JS. 5. If the app requires server features, review the static-export guide's unsupported features before choosing export mode. A static-file server does not provide those features.

The export message body and the missing-build message template are present in official Next.js canary source; the concrete missing-build path is release- and configuration-dependent (checked 2026-10-28): the missing-build path substitutes the configured directory; the export path rejects next start. The default distDir setting is .next; the cited canary server interpolates the resolved absolute distribution path in its missing-build error; capture the exact path from your installed release.

What to test

For server mode, verify a clean build completes and the intended startup command serves an app route. For static mode, inspect the generated output and test direct navigation to a nested route on the chosen static server. Check any runtime-dependent route against the official unsupported-feature list.

Public evidence

  • bbergeron-xlkey, discussion #69740, 2024-09-05 (checked 2026-10-28), reported that “The next dev command works at expected.” while production start failed after building. Their investigation exposed an output-directory mismatch and then the static-export startup error. Treat this as their configuration-specific account.
  • pky1341, discussion #65656, 2024-05-12 (checked 2026-10-28), wrote “I still get this error” after building in a container. The answer links to the first report; these are two reports sharing a resolution discussion, not independent confirmations of a universal container fix.

Pitfalls

Do not repeatedly run next start against static output. Do not assume the default output directory when configuration changes it. Do not delete build artifacts or change output mode before checking which mode the app needs. serve@latest is an unpinned command from the error text, not a verified package-version recommendation.

A prompt to give your agent

Read the linked official production-start error page, static-export guide and server source first; your training data may predate them. Capture the full error, installed Next.js version, scripts, output mode and output directory. Choose production build/start, development, or static-file serving from that evidence. If a build exists, check which artifact startup actually sees. Do not invent BUILD_ID or assume a container-specific fix. Test a route and a direct nested navigation after the smallest justified change.

Limits

The message baseline is Next.js canary source (checked 2026-10-28), not a pinned stable release guarantee. No application build, container deployment or static-serving test was run. Historical reports do not prove a general artifact-copy fix. Exact output-directory behavior must be checked against the reader's installed release and configuration.

Started from a post by @Vercel, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Next.js: Could not find a production build?
Summary: As of October 2026, run next build before next start for a production server, or next dev for development. With output: export, serve the generated static files instead; the official runtime error names npx serve@latest out. Official docs and canary source checked 2026-10-28.
Copy for agent
get the whatworks thread nextjs-could-not-find-production-build-or-output-export and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread nextjs-could-not-find-production-build-or-output-export
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp