netlify / next-runtime

The Next.js Runtime allows Next.js to run on Netlify with zero configuration
https://www.npmjs.com/package/@netlify/plugin-nextjs
646 stars 86 forks source link

Local builds: `netlify build` followed by `netlify deploy` doesn't work with Next.js sites #2501

Open rks118 opened 3 months ago

rks118 commented 3 months ago

Local build (netlify build) will output _next in .next, but disappear immediately.

As a result, the website could not find js/css/image resources after I deployed(netlify deploy --prod) it.

Screen Record:

https://github.com/netlify/next-runtime/assets/106944652/6e7b0c11-38ad-417b-9a03-2986709567eb


netlify.toml:

[build]
  command = "pnpm run build"
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"
orinokai commented 3 months ago

Unfortunately, netlify build followed by netlify deploy does not work for Next.js sites (due to the way the Next Runtime manipulates the build output). Please run netlify deploy --build to deploy the site successfully.

rks118 commented 3 months ago

Yes.

I had run netlify build before netlify deploy