NPM Error [ERR_REQUIRE_ESM] solution for node-fetch

Published: 01 January 1970
on channel: Agnim plays
1,292
6

NODE PACKAGE Manager --- Error [ERR_REQUIRE_ESM]:
Issue with node-fetch install , require() not working

Solution:

Step 1: open package.json and modify as follows (Add "type": "module")


{
"type": "module",
"dependencies": {
"node-fetch": "^3.1.0"
}
}


Step 2: change 1st line from const fetch = require('node-fetch'); to import fetch from 'node-fetch';


Step 3: now run again in terminal npm install node-fetch.


On this page of the site you can watch the video online NPM Error [ERR_REQUIRE_ESM] solution for node-fetch with a duration of hours minute second in good quality, which was uploaded by the user Agnim plays 01 January 1970, share the link with friends and acquaintances, this video has already been watched 1,292 times on youtube and it was liked by 6 viewers. Enjoy your viewing!