Astro npm run dev does not work

Hi everyone, As the main subject says, when i first start a new Astro project, with the following installation options steps: 1- npm create astro@latest 2- Choose a directory name "example" 3- How would you like to start your new project: empty 4- Do you plan to write Typescript: No 5- Install dependencies?: Yes 6- Initialize a new Git repo: No Once everything installed: 7- cd into "example" 8- run "npm run dev" And i've got the uploaded image error message. I've found out a fix, if i run "npm install typescript" or "npm install --dev typescript@latest " in the folder project, and then run "npm run dev" it WORKS !!!. It works if i choose in the installation process that i want to use typescript too. But i shouldn't do this, because it should work out of the box, without manually installing typescript modules. So here i am, i don't really understand why i can't run the project without typescript normally, as it should. Hope i was clear enough. Thank you for your time and read this !!!
No description
26 Replies
Jochem
Jochemβ€’2mo ago
between 7 and 8, you need to run npm install
alejandropd
alejandropdβ€’2mo ago
did it, but it didnΒ΄t work, here you have a screenshot
No description
alejandropd
alejandropdβ€’2mo ago
thanks for the quick reply btw, and live long and prosper of course
Jochem
Jochemβ€’2mo ago
That's an odd bug then... Especially cause you're selecting no typescript
alejandropd
alejandropdβ€’2mo ago
indeed, it doesn't make any sense, because i've watched @Kevin doing it without typescript and worked like a charm
Chooβ™šπ•‚π•šπ•Ÿπ•˜
I have used Astro many times and never had this problem. I see that you did omit the npm install initially and you also tinkered a bit by installing Typescript. My guess is you did some other changes you did not mention and maybe even forgot, and those changes introduced new problems. I recommend starting again from the beginning and just remember to npm install. My guess is that was the original problem and you created some new problems while trying to fix that.
alejandropd
alejandropdβ€’2mo ago
hi there, thanks for the reply. My guess was the same as you mentioned, something i did that i didn't notice before, so i did a few more new fresh projects, without doing anything else that the steps i've mentioned before. I have deleted the node_modules and reinstalled with npm install even, but no success. Only works when i manually install typescript or choose a typescript project.
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Did you start a completely new project or did you try to reset by deleting node_modules? I recommend a completely new project. You should not need to delete or reinstall anything for this to work.
alejandropd
alejandropdβ€’2mo ago
yep, completly new project. I'm using NVM with 22.8.0 node version
Chooβ™šπ•‚π•šπ•Ÿπ•˜
I just tested creating a new project with your options and it worked without any problems.
No description
alejandropd
alejandropdβ€’2mo ago
thank you for the time your taking to help me, here you go my screen, i did it a few seconds ago
No description
No description
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Interesting. I do have Typescript installed globally. Maybe there is a bug in Astro that I did not notice because Typescript is available. I recommend trying to do
npm install -g typescript
npm install -g typescript
You might need to start a new project from scratch again after that.
alejandropd
alejandropdβ€’2mo ago
already done a few seconds ago, the same result
No description
No description
alejandropd
alejandropdβ€’2mo ago
iΒ΄m starting to think there might be something to do with nvm or node versions NVM: 1.1.11 Node: 22.8.0 NPM: 10.8.2
Chooβ™šπ•‚π•šπ•Ÿπ•˜
I noticed that the error mentions Zod. Did you install that separately or modified the starter code with Zod as a dependency?
alejandropd
alejandropdβ€’2mo ago
not at all, and the craziest things it is already there
No description
Chooβ™šπ•‚π•šπ•Ÿπ•˜
Was example-three a completely empty folder or non-existent prior to creating the Astro project?
alejandropd
alejandropdβ€’2mo ago
yep, completly new folder created in the installation process
Chooβ™šπ•‚π•šπ•Ÿπ•˜
This is very unusual and I don't know why it is happening.
alejandropd
alejandropdβ€’2mo ago
yeah, the same happens to me, i'm totally lost. I have even used a different internet connection, in the case some dependencies didn't install properly and no luck donΒ΄t worry, i'm already working with the "npm install typescript" solution, i'll have to settle
Chooβ™šπ•‚π•šπ•Ÿπ•˜
The other strange thing is a local install of Typescript works but the global one didn't. Is there some kind of extra security on your computer? Are you using an account with restricted permissions? For example, is this a school owned computer?
alejandropd
alejandropdβ€’2mo ago
it's my own personal computer, but i'm working on a restricted work internet connection at my job, that is why i've tryed with my mobile data connection. I've even given full access folder permissions in my windows config in order to let it delete, write or modify whatever it needs
ἔρως
ἔρως‒2mo ago
are you sure you only need to run npm install and not npm install --save-dev? typescript is a development dependency
alejandropd
alejandropdβ€’2mo ago
i've just installed with npm install and npm install --save-dev, same result, same error are you guys using NVM ?
ἔρως
ἔρως‒2mo ago
im not using anything in my pc it's just something i noticed
alejandropd
alejandropdβ€’2mo ago
thank you
Want results from more Discord servers?
Add your server