Skip to content
Herby Design

How to export Next.js into HTML

Step 1: Add the “export” script Open your package.json and add this inside the “scripts” section: jsonCopyEdit”scripts”: { “dev”: “next dev”, “build”: “next build”, “start”: “next start”, “export”: “next build && next export” } ✅ This make...

H Hernan MalubayWeb Developer 1 min read Updated Oct 19, 2026
Instructions for exporting a Next.js app as static HTML files

Step 1: Add the “export” script

Open your package.json and add this inside the "scripts" section:

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

✅ This makes sure “export” is recognized.


🚀 Step 2: Run the Export Command

After adding the script, run:

npm run export

This will generate an out/ folder with static HTML files.


🚀 Step 3: Upload to Server

Move the contents of the out/ folder to:

/home/u000000000000/domains/public_html/foldername/

Now your Next.js app is a fully static HTML site on Web Server! 🎉


🔎 Still Not Working?

  • Run npm run to check available scripts.
  • Ensure your next.config.js has:
    module.exports = { output: "export", trailingSlash: true, };
  • Try running:
    rm -rf .next
    npm run build
    npm run export

Let me know if you need more help! 🚀 #NextReactDeveloper #NextJs #WebDeveloper

Need help with your website?

I build fast, SEO-ready websites and web applications.

Discuss your project
Programming Tips 1 min read

Modern PHP Tips for Cleaner Code

Small modern PHP features — match, the null-safe operator, named arguments, enums and readonly properties — that make code easier to read.

Read article
Web Development 1 min read

Mobile-First Design: Responsive Website Basics

Why your website should be designed for phones first, and the responsive design basics that make it easy to use on any screen.

Read article