Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

How to Fix the Most Common Astro Errors

The errors beginners hit most often in Astro, what they actually mean, and how to fix each one.

Tested on Astro 7.4

Cover image for How to Fix the Most Common Astro Errors
In this guide
  1. astro: command not found
  2. Expected corresponding JSX closing tag
  3. Could not resolve
  4. Missing data in a blog post
  5. My new collection or page isn’t showing up
  6. My words have run together
  7. More error guides
  8. None of these match

Errors look scary, but Astro’s are usually specific. Read them for the file name and line number first. We triggered each of these on Astro 7.4 so that you can see exactly what they say.

astro: command not found

sh: astro: command not found

What it means: your project’s tools aren’t installed.

How to fix it: run npm install inside your project folder. If it still fails, check you’re in the right folder. Your terminal should be in the one containing package.json.

More help: the full guide to astro: command not found.

Expected corresponding JSX closing tag

[CompilerError] Expected corresponding JSX closing tag for 'div'.

What it means: you opened a tag and never closed it. Older versions of Astro let this go, but Astro 7 doesn’t.

How to fix it: the error gives you the file and line. Look for a <div>, <p> or similar with no closing tag. Tags like <br> and <img> don’t need closing.

Could not resolve

Could not resolve '../layout/Layout.astro' in src/pages/about.astro

What it means: an import points at a file that isn’t there.

How to fix it: check the spelling and the path. In this example, the folder is layouts, not layout. Remember that ../ means “go up one folder”.

Missing data in a blog post

title: Required

What it means: a Markdown post is missing something your schema requires.

How to fix it: the error names the file. Add the missing field to the section at the top of that post.

My new collection or page isn’t showing up

What it means: the dev server may not have noticed a new config file.

How to fix it: stop the server with Ctrl and C, then run npm run dev again.

My words have run together

What it means: since Astro 7, spaces between inline elements are removed. So <b>Hello</b> <i>world</i> on separate lines can display as “Helloworld”.

How to fix it: add an explicit space with {" "} between the two elements.

More error guides

Each of these has its own page, with the exact message and the fix:

None of these match

Copy the first line of your error into a search engine with the word “Astro”, or ask in the Astro Discord. Say which version you’re on, which you can find by running npx astro --version.

Stuck on a step?

Check the common errors guide, look up a word in the glossary, or ask the friendly people in the official Astro and EmDash Discords. How to ask so people can help.

Keep reading

  1. How to Register a Domain Name and Connect It to Your Astro Site

    Buy a domain for about $11 a year, then point it at Cloudflare or Netlify. We did this for astronursery.com, and these are the exact steps.

    Tutorials, 8 minute read, November 8, 2026

  2. How to Add Google Analytics to an Astro Site (and a Simpler Option)

    Paste Google's tag into your Astro layout with one small change, is:inline, and it works on every page. Or use Cloudflare Web Analytics, which needs no cookie banner.

    Tutorials, 6 minute read, November 8, 2026

  3. How to Add a Contact Form to an Astro Site (No Server Needed)

    A static site can't receive form submissions on its own. A free form service can. Here's a working contact form in ten lines, with spam protection built in.

    Tutorials, 7 minute read, November 8, 2026

Try "blog", "deploy" or "EmDash".