Nuxt · NUXT0100
Give transitioned pages and layouts a single root node
Finds pages and layouts with multiple roots, or a text or comment root, when a transition applies on a known route. Doctor checks the reachable `<NuxtPage>` outlet, matched route metadata, and app defaults in Nuxt's precedence order. It checks only registered layouts it can associate with a `<NuxtLayout>` outlet and a transition. A `v-if`/`v-else-if`/`v-else` chain counts as one root; runtime-dependent transitions and lone `<slot>` roots are not reported.
Run this rule
pnpm nuxt doctor --rules nuxt/pages/single-root-node
Why it matters
Nuxt wraps pages in a <Transition> when a page transition is on, and layouts when a layout transition is on. A <Transition> can only animate a single element, so a page with several root nodes, or a text root, does not animate when you navigate to or from it. Vue keeps template comments in development, so a comment next to the root element also turns the page into a fragment there. Nuxt reports this in development as NUXT_E4004 for pages and NUXT_E4002 for layouts. Both are off by default (app.pageTransition and app.layoutTransition default to false), so pages without a transition are not reported.
Recommended fix
Wrap the template in a single root element, such as a <div>, and move comments inside it.
Useful links
Example
Give a transitioned page one root element
Before
<!-- nuxt.config.ts sets app: { pageTransition: { name: 'page' } } -->
<template>
<h1>Users</h1>
<UserList />
</template>
After
<template>
<div>
<h1>Users</h1>
<UserList />
</div>
</template>