I am trying to add the metadata object in my layout.js file. Hovever, I get the error “You are attempting to export “metadata” from a component marked with “use client”, which is disallowed.”, this seems weird because there is no “use client” in the file. I use Next.js(14.2.3) App router. I have checked the documentation but i have not been able to find a solution. I also delete the cache files, but still did not work.
Here is the content in my layout.js file
import { Inter } from "next/font/google";
const inter = Inter({ subsets: ["latin"] });
export const metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({ children, params: { lang } }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}