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
nuxt build
# static site generation
nuxt generate
# choose a deployment preset
NITRO_PRESET=node-server nuxt buildOptions
| Flag / Env | What it does |
|---|---|
| nuxt build | Build a server bundle into .output |
| nuxt generate | Pre-render all routes to static output |
| --prerender | Pre-render routes during build |
| NITRO_PRESET | Select 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.