Next js localhost:3001 suddenly starts shows 404 not found page in all routes what could be the problem

316 Views Asked by At

I am building a dashboard app on Next.js and suddenly my localhost refuses to work it keeps redirecting me to the 404 page. it happened before but I cant remember how I fixed it. Here is what I keep getting

image

I have tried deleting the .next folder and also also node modules. it still doesn't fix it. Please anyone has any idea on how to fix this

3

There are 3 best solutions below

0
On

ensure there's no folder with 'app' name on your root directory.

0
On

By any chance are you using shardcn or something which asks for global.css file. Check if it has created a new app/golabl.css file or any other directory which starts with name "app"

Just delete it and it will work

1
On

The most common mistake I have seen is naming the file 'Page.tsx' instead of 'page.tsx'. The other error might be in file architecture. Ensure your root folder has the folder "app" and the page.tsx and all the other routes should be inside the app folder.