Menu

1 / 5

Next.js 16 on GitHub Pages: fixing missing CSS, broken images and export errors

DEV Community: github·Nando Septian Husni·11 days ago
#lcN62KSa
#devtogithub#technology#devto#dev#next
Long article (1742 words) — no AI summary yet.
Reading 0:00
15s threshold

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 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.