Looks like the latest version of node-fetch changed to ES modules by default. You have two choices.
node-fetch
1 - Convert your project to ES modules by adding "type": "module" in your package.json. And then import using this syntax:
"type": "module"
package.json
import fetch from 'node-fetch';
2 - Uninstall the current version of node-fetch and install version 2 with: npm install node-fetch@2.
npm install node-fetch@2
The problem that has not been solved for two days has been solved thanks to you. Take care of COVID-19 and have a nice day.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Looks like the latest version of
node-fetch
changed to ES modules by default. You have two choices.1 - Convert your project to ES modules by adding
"type": "module"
in yourpackage.json
. And then import using this syntax:2 - Uninstall the current version of
node-fetch
and install version 2 with:npm install node-fetch@2
.The problem that has not been solved for two days has been solved thanks to you. Take care of COVID-19 and have a nice day.