Production builds
Create artifacts for a production deployment.
Next.js 16+ · Command
next build compiles a Next.js application for production, prerenders eligible routes, and writes the result to .next/. It also reports how routes are served.
Run the command from the project directory after configuring the application. Next.js loads environment variables and configuration, discovers routes, compiles application code, analyzes rendering, prerenders eligible routes, and writes the result to .next/; it also prints a route table. Use the generated build with next start for production Node.js hosting.
next build [options]| Name | Type | Description |
|---|---|---|
--debug-prerender | flag | Enables more detailed output for prerendering errors. |
--webpack | flag | Uses webpack instead of Turbopack for the build. |
Creates an optimized production build in .next/ and displays route information.
.next directory.next start in production mode.npm run buildRuns the package script that invokes Next.js to create the production build.
Create artifacts for a production deployment.
Inspect which routes are static, prerendered, or dynamically rendered.
Produce a minimal Node.js deployment with standalone output.
Investigate failures during prerendering.
next startnext devTurbopackoutput: 'standalone'generateBuildId