not-found.tsx not working
Answered
Minskin posted this in #help-forum
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.
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 😦
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'3 Replies
@Minskin 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 😦
can u try invoking not found manually?
import { notFound } from 'next/navigation'Answer
This can be done in your page.tsx
@gin can u try invoking not found manually?
typescript
import { notFound } from 'next/navigation'
MinskinOP
Oh. yeah. I'm a dumb dumb. my ide auto imported it from some werid next/dist- path and it failed. Ty.