Having trouble with import from node-fetch? How do I properly set it up in my project?

18 Replies, 981 Views

Yo, I had this issue too. If you’re getting errors when trying to import from node-fetch, it’s probably because node-fetch v3+ is ESM-only. You can either switch to CommonJS with `require('node-fetch')` or stick with ESM and add `"type": "module"` to your package.json.

Also, make sure your Node version is up to date. Sometimes older versions of Node 16 can be buggy with ESM. Good luck!

Messages In This Thread



Users browsing this thread: 1 Guest(s)