Deployment works for nextjs but leads to 404

Site:

My deploys do show to be successful, However upon clicking the link it leads to 404.

In my deploy settings, I have setup to use “npm run build”.

Just an FYI:
I am using Nextjs 10, and I do use “next/image”. My image provider is cloudinary and most of my site is static

Please suggest, the changes that needs to be made

Does your publish directory have an index.html?

what do it set in the “publish directory”
I am under the assumption that just running “npm run build” should suffice for nextjs.

Considering your package.json, looks like this:

"scripts": {
  "build": "next build && next export"
}

your build command is fine. If not, your package.json should probably look like that.

And if it’s a typical Next.JS website, your publish folder should be out.

Taken from here: Advanced Features: Static HTML Export | Next.js

1 Like

Is this applicable even for sites using the nextjs Image

I’m not sure, you’d have to try. Build your website locally first and check in what folder your static website is being generated. Set that as publish path.

I read somewhere there was a different way to run site, when using ‘nextjs’ with “next/image” and “next export” would not work with that.

Clearly I am wrong. when using external image providers. The solution you suggested works