NextRouter was not mounted React Origin: On your device OSI layer 7 · Application Last updated 9 Oct 2026

Error: NextRouter was not mounted.

next/router’s useRouter was used inside the App Router (app/ directory), which uses next/navigation instead.

Exact message you may see NextRouter was not mounted
Seen on: React

Meaning

The pages router and the App Router have different hooks. In app/ use useRouter, usePathname and useSearchParams from next/navigation.

Common causes

  • Importing useRouter from 'next/router' in app/
  • Shared components used by both routers

⚡ Quick fix

  1. Import from 'next/navigation' in the App Router
  2. Replace router.query with useSearchParams/useParams

Detailed fix by platform

React

  1. import { useRouter, usePathname } from 'next/navigation';

How to diagnose

  1. Router — app/ or pages/?
  2. Import — Which module?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

[Vue Router warn]: No match found for location with path — Vue Router: [Vue Router warn]: No match found for location with path "/users/42" (Vue)[Vue Router warn]: No…1019 — Cloudflare Error 1019: Compute server error (Workers) (Cloudflare)1019405 — HTTP 405 Method Not Allowed (HTTP)405async Client Component — Error: async/await is not yet supported in Client Components, only Server Components. (React)async Client ComponentCannot GET — API Error: Cannot GET /api/... / No route matches / The route could not be found (API)Cannot GETConflicting app and page file was found — Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx" (Next.js)Conflicting app and p…Dynamic server usage — Error: Dynamic server usage: Route /x couldn't be rendered statically because it used `cookies` (React)Dynamic server usageFunctions cannot be passed — Error: Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". (React)Functions cannot be p…NextRoute…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.