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, 1645 Views

Ah, the classic fetch in nodejs struggle! Node didn’t include fetch by default until recently, so you’ll need to either:

- Use Node 18+ (it’s built-in now!)
- Install node-fetch or undici if you’re on an older version.

Also, check if you’re mixing CommonJS/modules—that can break it. Axios is solid too, but fetch in nodejs is totally viable once you sort the setup.

Messages In This Thread



Users browsing this thread: 1 Guest(s)