Next.js Discord

Discord Forum

404 issue

Answered
Canada Warbler posted this in #help-forum
Open in Discord
Canada WarblerOP
Hi everyone, I m new to Nextjs, as i m trying to create an application, which worked perfect. Then suddenly every pages goes to 404. I m not sure what actually happened. Only thing i have changed is moved components outside the app dir.

"next": "15.5.4",
"react": "19.1.0",
"react-dom": "19.1.0"
Answered by Ray
remove /app if you are using src folder
View full answer

23 Replies

Canada WarblerOP
In compiled output, i could only see the _not-found dir.
directory for reference
Canada WarblerOP
I have done removing the .next and node_modules as well. But i got the same result.

Inside .next -> server dir, i have only _not_found folder.
Morelet’s Crocodile
When you moved the components out of app were the imports updated correctly ?
Canada WarblerOP
Yes, I have updated.
@Canada Warbler Yes, I have updated.
when you created your app (this app, the first time), did you already had a "src" folder or did you manually create it?
Canada WarblerOP
I already had the src.

I just moved the components outside of apps in src folder only
when i revert back the codes, the pages works as expected. !
@Canada Warbler I already had the src. I just moved the components outside of apps in src folder only
iirc the files need to be at least inside the "/src" folder. If you want to scale your project further or create shared ui, libs, apis, ... then I would use a turborepo instead of your try
Canada WarblerOP
they are inside the src
I m using daisyui, before i was structuring, the daisyui compilation was there, now that one is missing.
Can you share your tsconfig.json file?
Canada WarblerOP
{
  "compilerOptions": {
    "target": "ES2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"],
      "@/prisma": ["./app/generated/prisma"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}
I have only added @/prisma in path
hmm, I guess I am not deep enough inside your project to solve your issue. Thanks for sharing all the files. If you want, you can create a reproduction of the issue and like that we can have a look at the whole project to solve your issue
Canada WarblerOP
Sure, I will get you know.

"pnpm": {
"onlyBuiltDependencies": [
"@prisma/client",
"@prisma/engines",
"@tailwindcss/oxide",
"prisma",
"sharp"
]
},

will the above code in package.json result in breaking. ?
@Canada Warbler Yes, I have updated.
remove /app if you are using src folder
Answer
should be something created that folder for you
Canada WarblerOP
Hi @Ray ,

That works. 🙂
Thanks.
I have followed the prisma document for the same. that created app folder.