next build
failing to build static pages on pages router due to Error: NextRouter was not mounted
#65290
Labels
next build
failing to build static pages on pages router due to Error: NextRouter was not mounted
#65290
Link to the code that reproduces this issue
https://github.com/kcrwfrd/next.js-pages-build-error-reproduction
To Reproduce
Then I added a
useRouter()
call to mypages/index.tsx
.(fwiw just a fresh
reproduction-template-pages
template already suffered some of these errors you see, but adding theuseRouter()
call reproduced the sameError: NextRouter was not mounted
error that I was trying to troubleshoot in my original app).Current vs. Expected behavior
Static pages are expected to successfully build, but they are failing.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.6.0: Mon Feb 19 19:45:09 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T6000 Available memory (MB): 65536 Available CPU cores: 10 Binaries: Node: 18.20.2 npm: 10.5.0 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 14.3.0-canary.36 // Latest available version is detected (14.3.0-canary.36). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Pages Router
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: