Next.js Discord

Discord Forum

404 Page Not Found Error when deploying to Netlify

Unanswered
Cordilleran Flycatcher posted this in #help-forum
Open in Discord
Cordilleran FlycatcherOP
I created a Next.js website. I ran "npm run build" once the website was finished and tried dragging the .next folder that was created on to Netlify to deploy my website online.

I am getting this error when I go to the website.

I have created a _redirects file with the following line -

/* /index.html 200

Anyone know how I can fix this error on Netlify?

9 Replies

@joulev on netlify you should follow the official nextjs guide <https://docs.netlify.com/integrations/frameworks/next-js/overview/>
Cordilleran FlycatcherOP
Thanks. The website now loads but none of the images/files are visible. This is in place of a photo. This button does not lead to my resume. The "View my resume" text is also not black like I specified in css. These are all things that are working in the dev mode.
i'm honestly not sure, havent deployed nextjs to netlify in a very, very long time
@joulev i'm honestly not sure, havent deployed nextjs to netlify in a very, very long time
Cordilleran FlycatcherOP
alright, no worries! I've heard that the Image tag from Nextjs is not supported on Netlify. I will try switching over to the img tag
actually if you just want that icon i suggest using an icon library
like if you use lucide for example, it is just
() => (
  <button>
    <FileText />
    <span>View my resume</span>
  </button>
)

usable everywhere including netlify
@joulev actually if you just want that icon i suggest using an icon library
Cordilleran FlycatcherOP
I figured out the issue. The _redirects file in my public folder caused the js and css to not load. That file is necessary for React but not for Next!
oh yeah