Why isn't fetch in Node.js working like it does in the browser? or What's the best way to use fetch i

16 Replies, 1532 Views

Fetch in nodejs is weird because it wasn’t a thing until Node 18. Before that, everyone used node-fetch or axios.

If you’re getting "fetch is not defined," you’re probably on an older Node version. Check with `node -v`.

Quick fix: `npm install node-fetch@2` (v3+ is ESM-only, which might break your setup). Or upgrade Node!

Messages In This Thread



Users browsing this thread: 1 Guest(s)