Nuxt "nuxi build" Fails - Fix Nitro/Module Build Errors in CI
Nuxt builds the app with Vite/webpack and bundles the server with Nitro. The build fails when a module listed in nuxt.config is not installed, a Nitro preset is wrong for the target, or an auto-imported symbol cannot be resolved during the server build.
What this error means
nuxt build (or nuxi build) fails with Cannot find module '@nuxt/...'/a module error, a Nitro Failed to build message, or an auto-import resolution error. It is deterministic and names the module or Nitro step.
ERROR Cannot find module '@nuxtjs/tailwindcss'
imported from /app/nuxt.config.ts
ERROR Nitro build error
at build (nitropack/dist/core)Common causes
A configured module is not installed
A package listed in nuxt.config modules is missing from node_modules - not declared, or npm ci ran against a lockfile that omits it - so Nuxt cannot load it.
Wrong Nitro preset for the deploy target
The nitro.preset (or auto-detected one) does not match the host, so the server build fails or emits output the platform cannot run.
How to fix it
Install every configured module
Add each module from nuxt.config as a dependency so a clean install resolves it.
npm install -D @nuxtjs/tailwindcss
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxtjs/tailwindcss'],
})Set the Nitro preset for your target
Choose the preset matching the host instead of relying on detection in CI.
// nuxt.config.ts
export default defineNuxtConfig({
nitro: { preset: 'node-server' },
})How to prevent it
- Declare every
nuxt.configmodule indevDependencies. - Set
nitro.presetexplicitly for the deploy target. - Run
nuxt buildin CI so module and Nitro errors fail before deploy.