Next.js: Uncaught Error: No router instance found.

Created on 13 Feb 2017  路  7Comments  路  Source: vercel/next.js

1089

Uncaught Error: No router instance found.
You should only use "next/router" inside the client side of your app.

Sample Repo: here

Most helpful comment

I ran through the same error while npm linking a package which had next as a dependency. Turns out the error goes away if the package is not linked. @noway's answer brought me to that direction!

All 7 comments

Hey thanks.
But I can't run the error.

It's kind a great, if we can have a isolated issue for this case. Then it saves everyone's time and we could have a look at more issues.

I've tried to deploy this to now but having trouble with the installation there. But I've noticed when running next build && NODE_ENV=production next start locally the router seems to behave as intended.

that is weird, I got the same issue too. How can we make it work running dev?

Instead of running global next which doesn't pick up localy installed npm packages run npm run dev

fixed for me

I ran through the same error while npm linking a package which had next as a dependency. Turns out the error goes away if the package is not linked. @noway's answer brought me to that direction!

Running into this too, related to https://github.com/zeit/next.js/issues/3108 linking packages. Will try not using npm link.

Ran into this not having used getInitialProps on the page where the component was mounted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renatorib picture renatorib  路  3Comments

pie6k picture pie6k  路  3Comments

havefive picture havefive  路  3Comments

swrdfish picture swrdfish  路  3Comments

wagerfield picture wagerfield  路  3Comments