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

18 Replies, 762 Views

Hey! I had the same issue when trying to import from node-fetch. Turns out, in Node 16, you gotta use the ESM syntax. So instead of `import from node-fetch`, try `import fetch from 'node-fetch'` and make sure your package.json has `"type": "module"`.

Also, double-check if you’re using the latest version of node-fetch. Sometimes npm installs an older version by default. Hope that helps!

Messages In This Thread



Users browsing this thread: 1 Guest(s)