I am deploying my Next.js standalone application, but I am encountering a "Page Not Found" error

I have a Next.js standalone application with output: "standalone" configured in the next.config.js file. When I deploy it on Vercel, everything works perfectly. However, when deploying it on Netlify, I encounter a “Page Not Found” error.

The generated build does not include an index.html file since it’s a standalone app. While it functions on Vercel, it doesn’t work on Netlify. I need help publishing my Next.js site on Netlify.

My deployed site url is: https://geeksforgaming.netlify.app

I’d recommend checking out this support guide:

I have updated my netflify.toml:

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

[build]
publish = ".next"
command = "yarn build && yarn start"

[functions]
included_files = ["src/content/**"]

[build.environment]
NODE_VERSION = "18"
# __NEXT_PRIVATE_PREBUNDLED_REACT = "next"
# NEXT_FORCE_EDGE_IMAGES = true

# [[headers]]
# for = "/*" # This defines which paths this specific [[headers]] block will cover.

# [headers.values]
# X-Frame-Options = "DENY"
# X-XSS-Protection = "1; mode=block"
# Referrer-Policy = "same-origin"
# Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"

I also installed the @netlify/plugin-nextjs package. However, when deploying the app, the build process fails to complete.

The thing is the same code work like a charm when I deploy it on vercel without any additional step but not here if there’s any issue with my code it shouldn’t have worked on vercel either.

Why are you using a standalone output in the first place?

In any case, your first deploy did not have the Next.js plugin added which is why it’s not working. Based on your config, you’ve now added the plugin but you’re running next start, so the build never finishes. Your site is still serving the broken version.

My site is configured with output: standalone because I’m using generateStaticParams on several pages. When I attempt to build the app with output: export, I encounter the following error:

I want my site to be deployed as a standalone application. Does Netlify not support standalone deployments? Please clarify.

No, I’m trying to say you should not require to set any output. The defaults should work.

@hrishikesh, the default build method isn’t working for my project check SS. My app is configured with output: standalone, as it’s the only way it functions correctly. The build completes successfully and works locally, and it also deploys without any issues on Vercel.
Why can’t I use the standalone output on Netlify? If it’s possible, please provide clear instructions on how to set it up.

Thank you for the quick responses! I’ve resolved the issue on my own. My site is live now