Nuxt · Routing
NUXT0052Return navigateTo in route middleware
Finds Nuxt routing code that calls navigateto in middleware without returning the result.
vite-doctor/nuxtroutingerrorAuto-fix
Why it happens
Navigation helpers only work correctly in the runtime they were designed for. Returning the navigation result keeps redirects and aborts observable to Nuxt.
Fix
Return navigateTo() from route middleware so Nuxt can apply the redirect.
Example
Return navigateTo
Before
export default defineNuxtRouteMiddleware(() => {
navigateTo('/login')
})
After
export default defineNuxtRouteMiddleware(() => {
return navigateTo('/login')
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm nuxt doctor --rules nuxt/routing/return-navigateto-in-middleware