“Page not found” for 'nuxt build' command ('nuxt export' possibly needed)

Hey all - I am having this same issue for www.joshuasoileau.com

It’s a NextJS site, my publish directory is .next, and my build command is just npm run build, which does NODE_ENV=production next build.

It should be deploying to the /.next folder , but I get “Page not found” on the frontend of my site.

You can see my package.json here: JoshuaSoileau.com/package.json at master · JoshuaSoileau/JoshuaSoileau.com · GitHub

Can anyone help?

@JoshuaSoileau welcome to the Netlify community!

Next needs an export to be able to build out the static site. I have an example starter repo that you can see where I build out the nextjs example site. Although I use yarn and a monorepo, I’ve included the configuration you might want to consider below.

package.json scripts

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "export": "next export",
    "build:netlify": "npm run build && npm run export"
  },

netlify.toml

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

Build command: npm run build:netlify

cc: @perry The question should be split out to it’s own thread using title “Page not found” on a Next.js site"

Hi, @JoshuaSoileau. I moved this site to a new topic as I think it is specific enough to make a new topic helpful for people searching community for answers.

Also, I 100% think that @talves is correct with this analysis and solution. :+1:

Please do give his suggestions a try and, if there are other questions, reply here anytime.

1 Like