Skip to content
Latchkey

nuxt build: Nuxt Production Server Bundle

nuxt build compiles a Nuxt app for production into .output, ready to run as a Node server or deploy via a Nitro preset.

Nuxt 3 builds through Nitro. nuxt build makes a server-capable bundle; nuxt generate makes a fully static site. Picking the right one matters for CI.

What it does

nuxt build runs the Nitro production build and writes .output (server plus client assets). The deployment target is chosen by a Nitro preset (NITRO_PRESET or nitro.preset). nuxt generate instead pre-renders every route to static files.

Common usage

Terminal
nuxt build
# static site generation
nuxt generate
# choose a deployment preset
NITRO_PRESET=node-server nuxt build

Options

Flag / EnvWhat it does
nuxt buildBuild a server bundle into .output
nuxt generatePre-render all routes to static output
--prerenderPre-render routes during build
NITRO_PRESETSelect the Nitro deployment preset
--dotenv <file>Load a specific env file

In CI

Set NITRO_PRESET to match where you deploy (node-server, static, a serverless preset) so .output has the right shape. Use nuxt generate only for fully static sites; using it when you need server routes drops them silently.

Common errors in CI

"Nuxt build error" wrapping "Cannot find module" points at a missing dependency or a bad import path (case-sensitive on Linux). Prerender failures read "Error while prerendering route /..." usually from a failed data fetch during build. Deploying .output that does not match the platform means the wrong NITRO_PRESET was used.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →