DEV Community

Jim Lynch
Jim Lynch

Posted on

Next Export Is Broken / Doesn't Work With GH Pages?

I built a website with next.js that works locally (code:

I am now trying to deploy a static html version of the site to the domain:

I can clone the repo and run these commands:

nvm use
yarn install
yarn build
yarn export
yarn deploy-gh
Enter fullscreen mode Exit fullscreen mode

And I have changed the next.config.js file to reflect the repository that I'm using:

/* eslint-disable import/no-extraneous-dependencies */
const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',

module.exports = withBundleAnalyzer({
  poweredByHeader: false,
  trailingSlash: true,
  basePath: '/website',
  assetPrefix: '/website/',
  reactStrictMode: true,
Enter fullscreen mode Exit fullscreen mode

But my deployed site still looks wrong and has all these file-not-found errors...

enter image description here

How do I get janky piece to deploy properly?? 😅

Top comments (0)

Advice For Junior Developers

Advice from a career of 15+ years for new and beginner developers just getting started on their journey.