[Bug]: No router instance found
cdhiraj40 opened this issue · comments
Dhiraj Chauhan commented
Describe the bug:
Whenever I build the project NextJS throws an error showing "No router instance found". It's not a production problem* but a possible reason could be that during the build NextJS might have tried to access a router method like push which is not supported on the server side hence the error.
*I did not find this error on production.
Steps to reproduce the behavior:
- Build the project.
- See the error.
Expected behavior:
Well, it should not show the error 🤷🏽
Screenshots:
Additional context:
I think a possible solution would be to use the useRouter
hook rather than accessing the router object directly.
Read more about it here.