#after creating a new astro-beginner-project, "npm run start does not work"

3 messages · Page 1 of 1 (latest)

rigid jay
#

npm shows scripts dev, build, preview and astro. should I start one of those instead?

primal muskBOT
#

Hi @rigid jay. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes, you should use npm run dev instead of npm run start. The start script is not a standard Astro command.

According to the Astro documentation, when you create an Astro project, the following scripts are automatically added to your package.json:

{
  "scripts": {
    "dev": "astro dev",
    "build": "astro build",
    "preview": "astro preview"
  }
}

To start working on your project, you should run:

npm run dev

This command starts the Astro development server, which provides a live preview of your website at <http://localhost:4321> (by default) and automatically updates as you make changes to your code.

The other scripts serve different purposes:

  • npm run build - Builds your site for production
  • npm run preview - Previews your built site locally (must run build first)

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: