First-Time Next.js Deployment to Netlify Failing with 404 Errors

Hello everyone,

I am in the process of building my first Next.js site. I am extremely new to this, and I have read extensively on the forum and various blogs trying to resolve my 404 error on Netlify. I have changed and modified many configurations, whether in the next.config.ts file or in the redirects files. In short, I have really tried a lot of things.

Could someone provide me with new solutions beyond those already available on the forum? I would greatly appreciate your help. A big thank you in advance!

For your information:
My _redirects file is in the root with:/* /index.html 200

My next.config.ts **file is in the root with:**import type { NextConfig } from “next”;

const nextConfig: NextConfig = {
reactStrictMode: true,
swcMinify: true, // Optimization with SWC
output: “export”, // Allows using next export
images: {
unoptimized: true, // Netlify does not natively support Next.js image optimization
},
};

export default nextConfig;

My netlify.toml file is in the root with:[build]
command = “npm run build”
publish = “.next”

[[redirects]]
from = “/*”
to = “/index.html”
status = 200

[[plugins]]
package = “@netlify/plugin-nextjs”

We need site info to be able to check.

The website is available here: novacpe.netlify.app. Thank you!

Hi @Antoine_GS,

Thanks for following up and providing the site.

I see you’re doing a manual deploy, is that being done with Netlify CLI?

Is it a static site you’re deploying?

If so you may need to use the following for your netlify.toml:

[build]
  command = "npm run build"
  publish = "out"

[[plugins]]
  package = "@netlify/plugin-nextjs"

with the next.config.mjs configured as:

export default {
    output: "export", // Export static assets
  };

If you’re still having issues, could you provide a minimal reproduction?