Next.js Discord

Discord Forum

Facing Persistent Error with Custom 404 Page in Next.js: "Internal error: Error: The Default Export

Unanswered
American Shorthair posted this in #help-forum
Open in Discord
American ShorthairOP
I'm currently working on a Next.js project and have run into an issue with my custom 404 page. Despite the page functioning correctly, I keep receiving the following error message:


Internal error: Error: The default export is not a React Component in page: "/404"
Here's what I've already tried:

Ensured React is correctly imported.
Double-checked that the component is exported correctly.
Verified the component's file name and location (it's named 404.jsx and located in the pages directory).
Restarted the development server and cleared cache.
The component code looks like this:


import React from 'react';

const Custom404 = () => {
return <div>Page Not Found</div>;
};

export default Custom404;

The 404 page itself renders without any issues, but the error message persists. This is confusing as it suggests a problem with the component being recognized as a React component, yet it seems to work fine.

Has anyone encountered a similar issue or can offer any insights into what might be causing this error? Any help or suggestions would be greatly appreciated!

Thank you in advance!

0 Replies