How to Install Astro: Quick Setup Guide
To install
Astro, first ensure you have Node.js installed. Then run npm create astro@latest in your terminal to create a new Astro project with the latest version.Syntax
The basic command to install Astro is npm create astro@latest. This command downloads the latest Astro project starter and guides you through setup.
npm: Node.js package manager used to run commands.create: Tells npm to run a project scaffolding tool.astro@latest: Specifies the Astro starter package and ensures you get the newest version.
bash
npm create astro@latest
Example
This example shows how to create a new Astro project named my-astro-site. It will prompt you to choose a template and install dependencies.
bash
npm create astro@latest my-astro-site cd my-astro-site npm run dev
Output
โ Project created at ./my-astro-site
โ Dependencies installed
Local: http://localhost:3000/
Common Pitfalls
Common mistakes include:
- Not having
Node.jsinstalled or using an outdated version (Astro requires Node.js 16.8 or higher). - Running
npm create astrowithout@latestmay install an older version. - Not navigating into the project folder before starting the dev server.
Always check your Node.js version with node -v before starting.
bash
Wrong: npm create astro Right: npm create astro@latest
Quick Reference
Summary tips for installing Astro:
- Use
npm create astro@latestto start a new project. - Ensure Node.js version is 16.8 or higher.
- Run
npm installinside your project folder before starting the dev server. - Start development with
npm run dev.
Key Takeaways
Use the command
npm create astro@latest to install the latest Astro starter.Make sure Node.js version is 16.8 or newer before installing Astro.
Navigate into your project folder and run
npm install to install dependencies.Start your Astro development server with
npm run dev.Avoid omitting
@latest to prevent installing outdated versions.