NPM Error [ERR_REQUIRE_ESM] solution for node-fetch

Publié le: 01 janvier 1970
sur la chaîne: 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.


Sur cette page du site, vous pouvez voir la vidéo en ligne NPM Error [ERR_REQUIRE_ESM] solution for node-fetch durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Agnim plays 01 janvier 1970, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,292 fois et il a aimé 6 téléspectateurs. Bon visionnage!