Closed casually-creative closed 2 months ago
I'm hitting this too. I'm also hitting it with npm run dev
on a project that was originally working for me. It builds on netlify and deploys fine, but not locally.
My info: macOS: 14.5 (Sonoma) node: v18.20.3 npm: 10.8.1
I'm surprised this isn't higher visibility. I wonder why this isn't breaking everyone
I got around it by just downloading an example from the github repo and using that as my starter project.
I have honestly no idea how this could happen. fetch
is a global available on any versions of Node >=18. Looking on the internet, it seems like some people reported this happening with corrupted installations, or funky installations where multiple versions of Node (including an outdated one) were used somehow
You two are the only reports of this happening, so I have no idea, really. Without a way to reproduce, there's no ways for us to potentially fix this (I have no idea what we'd fix, though), so I'll close this. Please report back if this happens again, but in the meantime, I'm puzzled.
My suggestion would be to reinstall Node, make sure everything is updated etc, and try again.
I fixed my issue and it has nothing to do with astro, but I'm adding this comment in case someone else ends up here.
I found out that I had --no-experimental-fetch
set in my NODE_OPTIONS
Removing that option fixed the issue for me.
Astro Info
Describe the Bug
When running
pnpm create astro@latest
from any location on my machine, I receiveReferenceError: fetch is not defined
. Same result withnpm
. Complete output below:My info:
What's the expected result?
A working set-up guide.