#command not found: astro

4 messages · Page 1 of 1 (latest)

vast wraith
#

Does anyone know why I cannot use astro dev-build etc... ? When I run the scripts as "npm run dev" it works but shorter syntax doesn't work. Thanks in advance,

outer nest
#

Hey! Yeah so this is because the astro command won't be a registered executable in your system's PATH. When you do npm run dev , npm then runs JS which gets the astro command from the npm executable bin.

You can run npx astro ... if you're using npm, or pnpm exec astro ... for pnpm and that'll use the Astro command

vast wraith
#

so even with npx, I must still prefix "astro" command with npx correct? I thought I made a mistake somewhere with installation.

topaz elm
#

yes, with npx you have to prefix, keep in mind that npx have an optimization that first checks if the executable is already present in the project, if so it uses it, if not it downloads it

the position it checks is in node_modules/.bin/astro for example

This works because when you install astro it adds that file in creates the executable at node_modules/.bin/astro

this is also what gets executed when using astro inside npm scripts