Next.js Discord

Discord Forum

not-found.tsx not working

Answered
Minskin posted this in #help-forum
Open in Discord
MinskinOP
Hello,

My not-found.tsx isn't working in my next 14.2.13 app. It's at src/app/not-found.tsx with the rest of my app. The code is very simple.
import { PageLayout } from '@/app/shared/page-layout'
import React from 'react'

export default function NotFound() {
    return (
        <PageLayout>
            <h1 className={'mb-6 text-6xl underline underline-offset-8'}>
                data not found
            </h1>
            <div className={'animate-pulse opacity-80'}>error code 404</div>
        </PageLayout>
    )
}


It doesn't work on dev, or when deployed, I always get the default nextjs not found instead 😦

I've also tried renaming to .js but no luck.

Please help 😦
Answered by gin
can u try invoking not found manually?
import { notFound } from 'next/navigation'
View full answer

3 Replies