Install Node.js (LTS version recommended). You can verify it's installed with:
node -v
npm -vgit clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
cd YOUR_REPO_NAMEnpm installThis installs Astro and all other project dependencies into node_modules/. You do not need to install Astro globally.
| Command | Action |
|---|---|
npm run dev |
Start local dev server at http://localhost:4321 |
npm run build |
Build the production site to ./dist/ |
npm run preview |
Preview the production build locally |
Press Ctrl + C in the terminal.
npm run buildOutput goes into the dist/ folder. Upload or deploy the contents of dist/ to your host.
node_modules/— reinstalled vianpm installdist/— regenerated vianpm run build.astro/— Astro's local cache, auto-generated
/
├── public/ # Static assets (images, fonts, etc.)
├── src/
│ ├── components/ # Reusable UI components
│ ├── layouts/ # Page layouts
│ └── pages/ # One file = one route
├── astro.config.mjs # Astro configuration
└── package.json # Project dependencies and scripts
npm run dev fails after pulling changes?
Run npm install again — new dependencies may have been added.
Port already in use?
Another process is on port 4321. Stop it, or run npm run dev -- --port 3000 to use a different port.