Nitro · Server

NITRO0001Do not use navigateTo in Nitro routes

Nitro handlers should redirect with server response utilities instead of Nuxt app navigation.

Why it happens

navigateTo() is a Nuxt app navigation helper. Nitro handlers need to write an HTTP redirect response for the current request event.

Fix

Return the redirect response supported by the installed H3 runtime from the Nitro handler.

Example

Avoid navigateTo in Nitro

Before

export default defineEventHandler(() => {
  return navigateTo('/login')
})

After

export default defineHandler(() => {
  return redirect('/login')
})

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework nitro --rules nitro/context/no-navigateto-in-nitro
Copyright © 2026