Error: invariant expected layout router to be mounted

I'm trying to use Prismic, but whenever I create a project with Next.js and run npm run dev, I get this error:

1 Like

Hi @Melmoth,

Welcome to the community :slight_smile:

Does your layout.tsx file have a <body> and <html> tag? You can check Next.js documentation here about this and let me know if it fixes the issue.

Yes, it does have that in the layout.tsx, but the error still persists

Can you try moving </body> after <PrismicPreview>? :slight_smile: