Can you show your imports, because it could be that you are importing router from 'next/client'
Assuming that you are using functional-based component
You need to import router as follows:
import {useRouter} from "next/router";
in your function body:
const router = useRouter();
Edit, those who’re using NextJS v13+
The router has been moved from next/router
to next/navigation
https://nextjs.org/docs/app/api-reference/functions/use-router