NPM Error [ERR_REQUIRE_ESM] solution for node-fetch

Pubblicato il: 01 gennaio 1970
sul canale di: 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.


In questa pagina del sito puoi guardare il video online NPM Error [ERR_REQUIRE_ESM] solution for node-fetch della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Agnim plays 01 gennaio 1970, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,292 volte e gli è piaciuto 6 spettatori. Buona visione!