-
Use correct node version
nvm use
If you don't have the correct node version installed, you can install it by running the following command:
nvm install
then rerun:
nvm use
Note: This will install the node version specified in the
.nvmrc
fileNVM for Mac/Linux/WSL: https://github.com/nvm-sh/nvm
NVM for Windows: https://github.com/coreybutler/nvm-windows
-
Install dependencies
npm install
Also make sure you have the netlify-cli installed by running the following command:
npm install -g netlify-cli
-
Start the development server
npm run dev
or if you want to start the development server with the netlify functions:
npm run dev:netlify
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run dev:netlify |
Run a local dev server in a netlify like environment |
npm run build |
Build production site to ./dist/ |
npm run build:remote |
Build production site and production database to ./dist/ |
npm run build:netlify |
Build production in a netlify like environment |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
npm run format |
Run prettier formatter |
npm run lint |
Run prettier and astro linters |
Inside of your Astro project, you'll see the following folders and files:
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Card.astro
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
Astro looks for .astro
or .md
files in the src/pages/
directory. Each page is exposed as a route based on its file name.
There's nothing special about src/components/
, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the public/
directory.
Feel free to check our documentation or jump into our Discord server.