Closed datdoan closed 2 years ago
Very bizarre, not happening here with same Node version. Can you try running npm install
again? Perhaps something didn't get installed.
I have tried and still no luck. Also tried yarn create astro
and return the same error:
sh: astro: command not found
@datdoan, are you able to try without nvm
? Or can you check your nvm configuration? I’m wondering if this is an issue with your nvm configuration.
I will give that a try and let you know, thanks.
@datdoan, are you able to try without
nvm
? Or can you check your nvm configuration? I’m wondering if this is an issue with your nvm configuration.
without NVM it works, thank you for your help.
Does this mean we can't use nvm
with Astro?
I'm using NVM and I installed Astro globally (npm install -g astro) and then I've being using astro add, astro build etc.
I ran npm install -g astro
. Then after I could run npm run dev
with no troubles.
I recently encountered the same problem and resolved it by globally installing as the solutions above mention. Does anybody have any insight as to why this still seems to require the same work around even though astro doesn't explicitly include any language about globally installing in their documentation?
Very bizarre, not happening here with same Node version. Can you try running
npm install
again? Perhaps something didn't get installed.
Fixed for me.
It has happened just after installing
npx astro add astro-compress
Then, npm run dev
: sh: astro: command not found
Then npm install
and it runs again
*("astro-compress": "2.0.15",)
Very bizarre, not happening here with same Node version. Can you try running
npm install
again? Perhaps something didn't get installed.Fixed for me.
It has happened just after installing
npx astro add astro-compress
Then,
npm run dev
:sh: astro: command not found
Then
npm install
and it runs again*
("astro-compress": "2.0.15",)
I had this same thing happen to me when I ran npx astro add partytown
. Running npm install
fixed it.
i wonder if there's some way to detect nvm and offer people a better dx? or perhaps document this behaviour? it seems that if you npm install on an existing project when nvm is managing node, and on this dev machine you have not yet initialized a new astro project, you must also run npm install -g astro
in order to get things to work properly
i've been switching dev machines a lot this past year, so i've just become used to doing this, but i'm sure this is not a very obvious fix for people less familiar with the issue
just run npm install
or pnpm install
I am currently seeing this inside of some projects when running npm, yarn or even bun dev. After a first installation, especially at night. below is some output i get when this happens.
dev astro dev
sh: 1: astro: not found
Process finished with exit code 127
I am currently seeing this inside of some projects when running npm, yarn or even bun dev. After a first installation, especially at night. below is some output i get when this happens.
dev astro dev
sh: 1: astro: not found
Process finished with exit code 127
Have you try to running npm install
again?
I have done that multiple times with all package managers. Even deleting the whole directory and creating a new directory with the same name and get the same thing back astro not found.
The problem can occur if you have "/" in a folder name or a parent's folder name. Changing that just resolved the problem for me. Also, it's probably not advisable to solve the problem by installing Astro globally. [edit, missing words/spelling]
Thank you, I have switched to just using the cli tool when naming my frontend dir when using astro for it.
The same!
sh: astro: command not found at npm run dev
zsh: command not found: astro at astro dev
So, i tried starting npm install and npm fund and guess what?
npm run dev its working!
What version of
astro
are you using?0.22.1
What package manager are you using?
npm with nvm
What operating system are you using?
Mac with item
Describe the Bug
Using create-astro, getting error on npm run dev.
➜
npm init astro
Welcome to Astro! (create-astro v0.7.0) If you encounter a problem, visit https://github.com/withastro/astro/issues to search or file a new issue.
Next steps: 1: npm install (or pnpm install, yarn, etc) 2: git init && git add -A && git commit -m "Initial commit" (optional step) 3: npm run dev (or pnpm, yarn, etc)
To close the dev server, hit Ctrl-C
Stuck? Visit us at https://astro.build/chat
⬢ v16.13.0 took 17s ➜
npm install
npm WARN deprecated vscode-emmet-helper@2.1.2: This package has been renamed to @vscode/emmet-helper, please update to the new nameadded 470 packages, and audited 471 packages in 53s
182 packages are looking for funding run
npm fund
for detailsfound 0 vulnerabilities
⬢ v16.13.0 took 53s ➜
npm run dev
sh: astro: command not found
Link to Minimal Reproducible Example
none