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

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.

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 in the official Astro Discord, where the support channels are friendly to beginners.

Keep reading

  1. How to Deploy an Astro Site to Cloudflare Workers

    Put your Astro site online with Cloudflare Workers in four steps. This is how AstroBeginner itself is hosted, so every step has been run for real.

    Tutorials, 7 minute read, November 6, 2026

  2. How to Add Tailwind CSS to Astro

    Add Tailwind CSS to an Astro site with one command, then style your first element. Tested on Astro 7.4 and Tailwind 4.

    Tutorials, 5 minute read, November 6, 2026

  3. How to Add Images to an Astro Site

    Add an image to your Astro site, and let Astro shrink and convert it automatically. One test image went from 62 kB to 5 kB.

    Tutorials, 6 minute read, November 6, 2026

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