#'astro' is not recognized as an internal or external command

3 messages · Page 1 of 1 (latest)

vapid radish
#

I get this message when i try to run an existing astro project

formal jacinthBOT
#

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

#

This error usually occurs when Astro is not installed correctly or the system can't find it. According to the Astro documentation, Astro must be installed locally, not globally. Make sure you are not running npm install -g astro, pnpm add -g astro, or yarn add global astro. Instead, you should install Astro locally in your project using one of the following commands:

  • For npm: npm install astro
  • For pnpm: pnpm install astro
  • For Yarn: yarn add astro

After installing Astro, replace any placeholder “scripts” section of your package.json with the following:

"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "dev": "astro dev",
  "start": "astro dev",
  "build": "astro build",
  "preview": "astro preview"
}

If you're still encountering the issue, it might be related to the Node version manager you're using. Some users have reported similar issues when using nvm. One suggested workaround is to run npm install -g astro after initializing a new Astro project.

If none of the above solutions work, it might be a bug. In that case, you can open an issue (https://astro.build/issues/) on the Astro GitHub page.

Sources:


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