A Next.js site on GitHub Pages usually breaks in one of two ways: the build stops with an error, or the build passes and the live page shows up with no styles and broken images.
I started from a fresh create-next-app project, exported it, and served the out folder under /ghp/ on a small local server, the same way a project site lives at username.github.io/repo-name/ . Then I checked every page with Playwright. Below is each failure I hit, with the real output, and the config and workflow that fixed them.
Tested on Next.js 16.4.6, React 19.3.0, Tailwind CSS 4.3.3 and Node 22.23.5 .
1. output: 'export' fails on a fresh project
In 16.4.6, create-next-app writes a next.config.ts with cacheComponents: true and partialPrefetching: true .…