I tried installing authMiddleware for a tutorial using clerk but got an error saying that it doesn't exist.
I was installing clerk for this tutorial: https://www.youtube.com/watch?v=a02JAryRPVU, and I ran npm install @clerk/nextjs.
Then I put this code to enable authentication using authMiddleware
import { authMiddleware } from "@clerk/nextjs";
export default authMiddleware({});
export const config = {
matcher: ["/((?!.+.[w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
but I got an error, saying Module '"@clerk/nextjs"' has no exported member 'authMiddleware'.
When running the code through localhost, I got this error: TypeError: (0 , clerk_nextjs__WEBPACK_IMPORTED_MODULE_0_.authMiddleware) is not a function
I don't know how to fix this issue, any help would be appreciated.
I think the problem is the latest version of clerk, you may use the previous stable version of clerk (https://www.npmjs.com/package/@clerk/nextjs/v/4.30.0), this resolution fixed my problem.
npm i @clerk/[email protected]