Next.js Discord

Discord Forum

Default 404 page doesn't seem to work.

Answered
Checkered Giant posted this in #help-forum
Open in Discord
Avatar
Checkered GiantOP
I am trying to create a default 404 page, but it seems like its not working. I've attached relevant images.
Image
Image
Answered by American Chinchilla
Have you tried .js
View full answer

19 Replies

Avatar
Checkered GiantOP
If i move the not-found.jsx to app/[locale] it also doesn't seems to work. All I get is default next.js not found error, not my custom jsx page.
Image
Avatar
American Chinchilla
@Checkered Giant
Avatar
American Chinchilla
Have you tried .js
Answer
Avatar
Checkered GiantOP
Thanks it did worked !!
Thats wherei found it
It only mentions 2 file extensions
.tsx or .js
Np
Image
:marked
::marked
Avatar
Checkered GiantOP
@American Chinchilla actually it again throwing an error. It rendered the time I changed the extension. But now its broken.
Image
I tried importing a common component and using it,
Image
Avatar
1. add an empty app/layout.js
export default function Layout({ children }) {
  return children;
}

2. add <html> and <body> tags to the app/not-found.js
.js, .jsx and .tsx all work, so changing the file extension is not the solution
Avatar
Checkered GiantOP
it did worked though but it seems to be failing build.
Image
Avatar
Checkered GiantOP
here is my layout.js file
Image