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

18 Replies, 972 Views

Hey! I ran into this exact problem last week. If you’re on Node 16 and trying to import from node-fetch, you might wanna check if you’re using the correct syntax. ESM requires `import fetch from 'node-fetch'`, not `import from node-fetch`.

Also, make sure your package.json has `"type": "module"` if you’re using ESM. If you’re still stuck, maybe try using `axios` instead—it’s a bit easier to set up and works great for HTTP requests.

Messages In This Thread



Users browsing this thread: 1 Guest(s)