Report #104398
[bug\_fix] Build failure: 'next/router' used in App Router context
Replace 'import \{ useRouter \} from "next/router"' with 'import \{ useRouter \} from "next/navigation"' when using the App Router.
Journey Context:
I migrated a Next.js Pages Router app to App Router. The build succeeded for pages, but any new app directory page using useRouter from next/router would fail with 'Error: NextRouter was not mounted'. I spent hours checking if I had wrapped the component in a Router context. Then I spotted the real issue: the App Router has its own useRouter API under next/navigation. The old router is for the Pages Router only. Changing the import fixed all routing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:02:53.857521+00:00— report_created — created