Next.js Discord

Discord Forum

No Root Layout -- Only Layouts in Route Groups

Answered
Sloth bear posted this in #help-forum
Open in Discord
Sloth bearOP
I am working with next 13.4 and I am trying to create different layouts logged in vs logged out. I am following this help article https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts and I am getting an error --
./
Module not found: Can't resolve '/home/usrname/repos/lms/apps/web/app/layout.tsx'

https://nextjs.org/docs/messages/module-not-found


when I navigate to /dashboard, but /, /signup, /login renders its layout just fine. What am i missing here.

layout.tsx is the same code in both route groups currently. Any help would be appreciated!
Answered by Rafael Almeida
usually this error happens when the build folder has stale data. try deleting the .next folder and restarting the dev server
View full answer

5 Replies

Sloth bearOP
Follow up -- i can get the layout to work if I move it under /(loggedin)/dashboard, but if the layout is just under /(loggedin) it has the error.
Sloth bearOP
Another interesting behavior -- i created a second route /(loggedin)/test/page.tsx. It does errors. but now /(loggedin)/dashboard renders with the layout
usually this error happens when the build folder has stale data. try deleting the .next folder and restarting the dev server
Answer
Sloth bearOP
ill give it a shot
You are the hero! that worked. tysvm