# Nuxt Generate Shows a Blank Page — .output/public, baseURL and _nuxt

Canonical: https://commareports.com/fix/nuxt-generate-blank-page
Published: 2026-11-24

> `nuxt dev` works, but the `nuxt generate` output is blank, unstyled or 404s. The cause behind each symptom — absolute /_nuxt paths on file://, ssr: false shells, app.baseURL and Jekyll on GitHub Pages, routes the crawler missed, hydration mismatches — and the fix for each.

# Nuxt generate shows a blank page

`nuxt dev` works. `nuxt generate` finishes and writes `.output/public/`. Then
the static site is a white screen, plain unstyled text, or a home page whose
other routes 404.

What you see depends on rendering mode. With the default `ssr: true`, Nuxt
prerenders each page to HTML, so you usually see the content and lose the
styles or the interactivity. With `ssr: false`, every page is the same empty
shell until JavaScript runs, so any loading problem gives a blank page. Open
the console (F12 → Console) and the Network tab before you change anything.
For other frameworks see [Vite](/fix/vite-build-blank-page),
[React](/fix/react-build-blank-page), [Angular](/fix/angular-build-blank-page),
[Next.js](/fix/nextjs-static-export-blank-page) and
[SvelteKit](/fix/sveltekit-static-build-blank-page).

## Match the symptom to the cause

| What you see                                                   | Cause                                      | Section                   |
| -------------------------------------------------------------- | ------------------------------------------ | ------------------------- |
| Text but no styles or clicks from disk, `/_nuxt/…` not found   | Absolute `/_nuxt/` paths on `file://`      | Opened from disk          |
| Blank page from disk with `ssr: false`                         | The SPA shell can't load its JavaScript    | Opened from disk          |
| `404` for every `/_nuxt/…` file on GitHub Pages                | Jekyll skipped `_nuxt`, or no `baseURL`    | GitHub Pages              |
| Page loads, then client-side navigation breaks on GitHub Pages | Jekyll skipped `_payload.json`             | GitHub Pages              |
| Images and links go to the domain root below `/repo/`          | Hardcoded `/` paths ignore `baseURL`       | GitHub Pages              |
| `/blog/new-post` 404s, `/blog/first-post` works                | The crawler never found that route         | Routes the crawler missed |
| Every deep link 404s with `ssr: false`                         | Host doesn't serve the `200.html` fallback | Routes the crawler missed |
| `Hydration completed but contains mismatches`                  | Server HTML and first client render differ | Hydration mismatch        |
| `Failed to fetch dynamically imported module` after a deploy   | Cached HTML points at deleted chunks       | Stale chunks              |
| `404` from `/api/…` on the live site                           | Server routes don't exist on a static host | Server routes and config  |
| A `runtimeConfig` value is empty or still the dev value        | Frozen at build time                       | Server routes and config  |

## Which folder to deploy

`nuxt generate` (or `nuxt build --prerender`) writes the site to
`.output/public/`. It also creates `dist/` as a link to that folder, which
some hosts follow and some upload as an empty link. Point the host, the
artifact upload or the zip at `.output/public/` itself.

`nuxt build` without prerendering produces a Node server in `.output/server/`.
Uploading `.output/public/` from that build gives assets with no HTML, and
every page 404s.

On Nuxt 2 the command is the same but the output is `dist/`, the setting is
`target: 'static'`, and the base path is `router.base`.

## You opened .output/public/index.html from disk

Look at the source of any generated page:

```html
<link rel="stylesheet" href="/_nuxt/entry.Dh3k.css" />
<script type="module" src="/_nuxt/BfY2a9.js" crossorigin></script>
```

On a web server `/_nuxt/` is under the site root. On a `file:///` page it is
under the root of your disk, so every stylesheet and script fails with
`ERR_FILE_NOT_FOUND`. Two more things stop it even if you fix the paths: the
scripts are ES modules, which browsers won't load from a `file://` origin, and
client-side navigation fetches `_payload.json` files, which
[a `file://` page can't fetch](/fix/cors-error-file-origin-null).

- **`ssr: true` (default):** the prerendered text shows. Component styles that
  Nuxt inlined may apply; global CSS doesn't. Nothing is interactive.
- **`ssr: false`:** `index.html` is an empty `<div id="__nuxt">` and stays
  blank.

There is no relative-path mode to switch on; `app.baseURL: './'` is not
supported. Serve the folder over HTTP:

```bash
npx serve .output/public
```

## GitHub Pages: \_nuxt 404s and app.baseURL

Two separate things break a Nuxt site on GitHub Pages.

**Jekyll eats every underscore.** When Pages publishes from a branch it runs
Jekyll, which skips files and folders starting with `_`. That removes
`_nuxt/` (every script and stylesheet) and each page's `_payload.json` (the
data client-side navigation loads). Either add an empty file that the build
copies across:

```bash
touch public/.nojekyll
```

or build with the Nitro preset for Pages, which writes `.nojekyll` and a
`404.html` for you:

```bash
NITRO_PRESET=github_pages npx nuxt generate
```

Deploying with the `actions/deploy-pages` workflow skips Jekyll, so the first
fix only matters for branch deploys.

**A project site lives below the root.** `https://user.github.io/repo/` asks
for `https://user.github.io/_nuxt/…` and gets a 404. Set the base URL at build
time:

```bash
NUXT_APP_BASE_URL=/repo/ npx nuxt generate
```

or in config:

```ts
// nuxt.config.ts
export default defineNuxtConfig({
  app: { baseURL: "/repo/" },
});
```

Unlike Next.js and SvelteKit, Nuxt's base URL keeps its trailing slash. It
prefixes `<NuxtLink>` routes and the `_nuxt` assets. It does **not** prefix
paths you wrote by hand:

| Written as                | With `baseURL: "/repo/"` it requests | Fix                                                      |
| ------------------------- | ------------------------------------ | -------------------------------------------------------- |
| `<a href="/about">`       | `/about` (404)                       | `<NuxtLink to="/about">`                                 |
| `<img src="/logo.png">`   | `/logo.png` (404)                    | Put it in `assets/` and import, or prefix it             |
| CSS `url(/fonts/x.woff2)` | `/fonts/x.woff2` (404)               | `url(~/assets/fonts/x.woff2)`                            |
| `fetch("/data.json")`     | `/data.json` (404)                   | ``$fetch(`${useRuntimeConfig().app.baseURL}data.json`)`` |

With a custom domain the site is at `/` again, so drop the base URL or every
asset 404s.

## Routes the crawler missed

The home page and anything it links to are generated. A page nothing links to
isn't, and it 404s on a static host.

The prerenderer starts at `/` and follows links. Product pages loaded from an
API, posts only reachable through search, and routes behind a button click
are never found. List them:

```ts
// nuxt.config.ts
export default defineNuxtConfig({
  nitro: {
    prerender: {
      crawlLinks: true,
      routes: ["/blog/new-post", "/sitemap.xml"],
    },
  },
  routeRules: {
    "/docs/**": { prerender: true },
  },
});
```

For a long list, fetch it in a `prerender:routes` hook in `nuxt.config.ts` and
add each route to `ctx.routes`. Check what was generated by listing
`.output/public/` after the build.

**With `ssr: false`** every route uses the same shell, so the host has to
answer unknown paths with it. Nuxt writes `200.html` and `404.html` for this.
Netlify and Surge pick up `200.html`; GitHub Pages serves `404.html`; nginx
needs `try_files $uri $uri/ /200.html;`; S3 and CloudFront need the error
document set to `200.html` with a 200 response.

Nitro writes prerendered pages as `about/index.html`, so refreshing a
prerendered route works on every static host without extra config.

## Hydration mismatch

```
[Vue warn]: Hydration completed but contains mismatches.
```

The HTML written at build time differs from the first render in the browser,
so Vue patches the page. Usually that only flickers. It blanks the page when
the patch throws, or when the difference is a whole component. Common causes
on a generated site:

- **Values that differ between build and visit:** `new Date()`,
  `Math.random()`, the visitor's locale or time zone. Compute them in
  `onMounted`, or wrap the component in `<ClientOnly>`.
- **Browser-only APIs during setup:** `window`, `localStorage` or `document`
  read at the top of `<script setup>` throw during prerendering. Guard with
  `if (import.meta.client)` or move them into `onMounted`.
- **Invalid HTML nesting:** a `<div>` inside a `<p>`, or a `<tr>` without
  `<tbody>`. The browser repairs the markup before Vue hydrates, so the DOM no
  longer matches.

The console names the component in development; rebuild with
`sourcemap: { client: true }` to get real file names in production.

## Stale chunks after a deploy

```
TypeError: Failed to fetch dynamically imported module:
https://example.com/_nuxt/Cq7xY2.js
```

A visitor's tab (or a CDN) still holds HTML that imports hashed chunks the new
build replaced. Nuxt catches this by default and reloads the page on the next
navigation (`experimental.emitRouteChunkError: 'automatic'`). If it keeps
happening, the HTML is cached: serve HTML with `Cache-Control: no-cache` and
`_nuxt/` with a long immutable cache.

If the Network tab shows the chunk came back as HTML with a 200, the path is
wrong instead: a host with an SPA fallback answers a missing file with the
shell. See the `baseURL` section.

## Server routes and config

A generated site is files. These need a running server:

- **`server/api/` routes.** A `useFetch("/api/products")` that runs during
  prerendering is called once at build time, and the result is saved in the
  page payload. The same call made only in the browser, in `onMounted` or on a
  click, requests an endpoint that doesn't exist. Point it at an external API,
  or fetch the data at build time.
- **`runtimeConfig`.** On a server, `NUXT_PUBLIC_API_BASE` overrides
  `runtimeConfig.public.apiBase` at request time. On a static host nothing
  runs at request time, so the value from the build is final. Set the
  variable in the CI job that runs `nuxt generate`; setting it in the host's
  dashboard afterwards changes nothing.
- **Server middleware, `useCookie` set on the server, redirects in
  `routeRules`** need a server or the host's own redirect rules.

## Stop sending the output folder

Every file-based fix above has a ceiling: the person you send
`.output/public/` to still needs a local server, because every asset path
starts at `/_nuxt/`. A build preview works best as a URL.

Comma takes the folder or a zip of it and returns one link. Assets upload
alongside the HTML with their references rewritten, so the `_nuxt`,
`baseURL` and `file://` problems don't apply, and reviewers comment on the
exact element they mean instead of sending a screenshot.
[Share a Nuxt static site](/share-nuxt-static-site) has the steps.

Two honest caveats. Reports run in a sandboxed iframe with scripts enabled but
no same-origin access, so code that reads `localStorage` or cookies without a
`try/catch` throws there. And leave `app.baseURL` at its default for a
preview build; it bakes in a path the preview isn't served from.

**[Publish a build preview →](https://commareports.com/)**

### Related

- [SvelteKit adapter-static build shows a blank page](/fix/sveltekit-static-build-blank-page)
- [Vite build shows a blank page](/fix/vite-build-blank-page)
- [Next.js static export shows a blank or unstyled page](/fix/nextjs-static-export-blank-page)
- [CORS error from origin 'null'](/fix/cors-error-file-origin-null)
- [ERR_FILE_NOT_FOUND in Chrome](/fix/err-file-not-found)
- [My HTML report lost its CSS](/html-report-broken-css)
- [Share a Nuxt static site](/share-nuxt-static-site)
