Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Fixing A Index Page Not Found Error On A NextJS Site On Netlify

I setup a new Next.js site on Netlify that didn't quite work out of the box. When I did the deploy, I'd get "Page Not Found" on the home page. I'm not sure, but I think the reason is because I pointed Netlify at the GitHub repo before I pushed up the next.js code.

The things I needed to do for the fix were:

1. In the UI under "Site Settings - Build and Deploy - Continuous Deployment - Build Settings" set:

- Base directory: `/` - Build command: `npm run build` - Publish direcotry: `/.next`

2. Under "Plugins", install the "Essential Next.js" plugin for the site.

With those change the next push/deploy got things working as expected.

NOTE: I think it's also possible to install the plugin as a module directly in your development environment with this instead of installing the plugin from the UI:

Code

npm install --save @netlify/plugin-nextjs