Next.js Discord

Discord Forum

Getting a `NextRouter not mounted` error in `pages` directory

Answered
Snowy Plover posted this in #help-forum
Open in Discord
Snowy PloverOP
I'm upgrading Next 13 to 14 and I started getting this error during build. It seems to only happen on static pages but I can't seem to figure out the problem.

I tried using the 'next/compat/router' but I don't think that is really the problem. I'm. not using the app router at all in this project.
Answered by Snowy Plover
I managed to find a thread that had the same issue:
https://github.com/vercel/next.js/issues/56481

It seems like the NODE_ENV was creating the issues. I'll mark as solved.
View full answer

2 Replies

Snowy PloverOP
Some additional details, if I use 'next/compat/router' I get the following error in the same pages:

Error: <Html> should not be imported outside of pages/_document.
Snowy PloverOP
I managed to find a thread that had the same issue:
https://github.com/vercel/next.js/issues/56481

It seems like the NODE_ENV was creating the issues. I'll mark as solved.
Answer