🔥 All-Access Pass — $199 USD (Regular $499) · Unlock all 2,836 Astro themes ➔
komal.nakrani
Get All-Access Pass ($199)
ThemesCategoriesDocsBlogTips & TricksPricingGet All-Access Pass ($199)
Astro Themes••By Komal Nakrani

How to Install an Astro Theme Step by Step (2026)

How to install an Astro theme step by step: requirements, getting the code from GitHub or a purchase, npm install, running locally, configuring and deploying.

#Astro#Astro Themes#Install Astro Theme#Getting Started

To install an Astro theme, make sure Node.js 22.23.4 or newer is installed, get the theme’s code (with npm create astro@latest -- --template owner/repo, git clone, or the repository you were given after a purchase), run npm install, then npm run dev to see it at http://localhost:4321. From there you set your domain in astro.config.mjs, put the project in your own Git repository, and deploy the output of npm run build to any static host.

This guide walks through each step, covers the three common ways themes are delivered, and ends with fixes for the errors people hit most often on a first install. It applies to free themes from GitHub and paid themes from any seller, including ours.

Key Takeaways

  • Astro 7 requires Node.js 22.23.4 or newer; check with node -v before anything else.
  • Free themes on GitHub install in one command with npm create astro@latest -- --template owner/repo.
  • Purchased themes usually arrive as a private repository or a ZIP; clone or unzip, then npm install.
  • Use the package manager that matches the theme’s lockfile to get the exact versions the author tested.
  • Set site in astro.config.mjs before your first deploy, or your sitemap and canonical URLs will point at the wrong domain.

Step 1: check the requirements

You need three things on your computer:

  1. Node.js 22.23.4 or newer. Astro 7 will not run on older versions. Install the current LTS release from nodejs.org or with a version manager such as nvm or fnm.
  2. Git. Needed to clone themes and, later, to receive updates.
  3. A code editor. VS Code with the official Astro extension gives syntax highlighting and type checking for .astro files.

Check your versions in a terminal:

# Terminal
node -v    # should print v22.23.4 or higher
npm -v
git --version

If node -v prints an older version, upgrade first. Most first-install failures come from an old Node.js. Our Astro VS Code setup guide covers the editor side.

Step 2: get the theme’s code

How you get the code depends on where the theme comes from.

A free theme on GitHub

Most free Astro themes live in public GitHub repositories. The Astro CLI can copy any of them into a new folder in one step:

# Terminal
npm create astro@latest -- --template onwidget/astrowind my-site

Replace onwidget/astrowind with the theme’s owner/repo from its GitHub URL, and my-site with your folder name. The CLI asks whether to install dependencies and initialise a Git repository; answer yes to both. This gives you a fresh copy with no link back to the original repository’s history.

If you want the full history, or plan to pull the author’s updates later, clone it instead:

# Terminal
git clone https://github.com/onwidget/astrowind.git my-site
cd my-site

A purchased theme delivered as a private repository

Many paid themes, including ours, are delivered as access to a private GitHub repository. You receive an invitation at your order email; accept it while signed in to GitHub, then clone:

# Terminal
git clone [email protected]:seller-org/theme-name.git my-site
cd my-site

If the SSH address fails with a permission error, either add an SSH key to GitHub or use the HTTPS address from the repository’s green Code button. For our themes, the quickstart guide has the exact steps.

A ZIP download

Some sellers send a ZIP file. Unzip it, open the folder in a terminal, and run git init so you have version control from the start. Without Git, keeping track of your edits and applying future theme updates is much harder.

Step 3: install dependencies

Inside the project folder, install the packages listed in package.json. Use the package manager that matches the lockfile the theme ships:

Lockfile in the project Command
package-lock.json npm install
pnpm-lock.yaml pnpm install
yarn.lock yarn install
bun.lock bun install

The lockfile pins the exact versions the author tested. Using a different package manager ignores it and may pull in newer, untested versions. Our comparison of npm, pnpm and Bun for Astro covers the trade-offs if you want to switch later.

Installation usually takes under a minute. Warnings about deprecated sub-dependencies are common and usually harmless; errors are not, so read them.

Step 4: run the theme locally

Start the development server:

# Terminal
npm run dev

Astro prints a local address, normally http://localhost:4321. Open it and you should see the theme exactly as in its demo. Edits to files under src/ reload in the browser as you save.

To test on your phone over the same Wi-Fi network, expose the server on your local network:

# Terminal
npm run dev -- --host

Astro then prints a network address such as http://192.168.1.20:4321 that you can open on the phone. Look through every page now, before you change anything, so you know what a working baseline looks like.

Step 5: configure the essentials

Before you customise the design, set the values that affect the whole site:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://your-domain.com',
  integrations: [sitemap()],
});

Keep whatever integrations the theme already lists; only change site to your real domain. Astro uses it for canonical URLs, the sitemap and RSS feeds, and a placeholder left here is the most common setup mistake. Then update the site name, description and social image defaults, which most themes keep in a config file under src/ or in the main layout. Our installation and setup docs list the values worth changing first.

Step 6: put it in your own repository

Commit the untouched theme as a baseline before your first edit. That gives you something to compare against and makes updates easier:

# Terminal
git add -A
git commit -m "Install theme baseline"

If you cloned the author’s repository, its address is your origin. Rename it to upstream and add your own repository as origin, so your pushes go to your repo and theme updates come from theirs:

# Terminal
git remote rename origin upstream
git remote add origin [email protected]:your-name/my-site.git
git push -u origin main

Make your own repository private if the theme is a paid one; most commercial licences do not allow republishing the theme’s source publicly. Our guide to updating a purchased Astro theme shows how to merge upstream changes later.

Step 7: build and deploy

Build the production site and preview it locally:

# Terminal
npm run build
npm run preview

npm run build writes static HTML, CSS and assets to dist/. Any static host can serve that folder. Connect your repository to Cloudflare Pages, Netlify or Vercel, set the build command to npm run build and the output directory to dist, and every push to main deploys. The Cloudflare Pages deployment docs walk through it step by step, and our Astro deployment guide compares hosts.

Fixing common install errors

“Node.js vXX is not supported by Astro.” Your Node.js is too old. Install 22.23.4 or newer and run npm install again. On a host, set the Node version in the project settings, for example NODE_VERSION=22 on Cloudflare Pages or Netlify.

astro: command not found or sh: astro: not found. Dependencies are not installed. Run npm install in the project folder, not a parent folder.

Port 4321 already in use. Another dev server is running. Stop it, or start this one on another port with npm run dev -- --port 4322.

Image errors mentioning sharp. Astro’s default image service uses sharp, which some package managers do not install automatically. See our tip on fixing the missing sharp error.

Permission denied (publickey) when cloning. GitHub does not recognise your SSH key, or you have not accepted the repository invitation. Accept the invitation, then clone with the HTTPS address or add an SSH key.

Lockfile or peer dependency conflicts. Delete node_modules, keep the lockfile, and reinstall with the matching package manager. Avoid --force unless you understand the conflict.

If you haven’t picked a theme yet, browse Astro themes by category and open the live preview of any design before you install it.

FAQ

How do I install an Astro theme from GitHub?

Run npm create astro@latest -- --template owner/repo my-site, using the theme’s owner and repository name from its GitHub URL. The CLI copies the theme, installs dependencies and initialises Git. Then run npm run dev inside the new folder.

Do I need to know how to code to install an Astro theme?

You need to be comfortable running a few terminal commands and editing text files. Installing and running a theme takes about five commands; customising it takes basic HTML and CSS knowledge.

What version of Node.js do I need for Astro themes?

Astro 7 needs Node.js 22.23.4 or newer. Older themes on Astro 4 or 5 may run on Node.js 18 or 20, but check the engines field in the theme’s package.json.

Can I install an Astro theme into an existing Astro project?

Not directly. A theme is a complete project, not a plugin. Start from the theme and move your existing content and pages into it, or copy the components and layouts you want from the theme into your project.

How long does it take to install an Astro theme?

Usually five to ten minutes from download to running locally, most of which is npm install. Configuring, customising and deploying takes longer, depending on how much you change.