Read the statement by Michael Teeuw here.
Cannot find module 'node-fetch' error with multiple MM modules
-
Thanks for info and pointers! Did the NPM install in base, but ended into a new obstacle.
BR,
Saku[05.10.2023 22:47.23.542] [ERROR] (node:8355) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/saku/MagicMirror/modules/publika/node_modules/node-fetch/src/index.js from /home/saku/MagicMirror/modules/publika/node_helper.js not supported. Instead change the require of index.js in /home/saku/MagicMirror/modules/publika/node_helper.js to a dynamic import() which is available in all CommonJS modules. at Function._load (node:electron/js2c/asar_bundle:2:13327) at Object.<anonymous> (/home/saku/MagicMirror/modules/publika/node_helper.js:3:15) at Function._load (node:electron/js2c/asar_bundle:2:13327) at loadModule (/home/saku/MagicMirror/js/app.js:180:19) at loadModules (/home/saku/MagicMirror/js/app.js:210:10) at async App.start (/home/saku/MagicMirror/js/app.js:258:3) (Use `electron --trace-warnings ...` to show where the warning was created)
-
@blackbull yes, I saw someone else with the same problem
it was the node-fetch version
do this
npm install node-fetch@2
-
@sdetweil YES! Big thanks! :)
That needed to be run in the specific module folder, installing that in MM base did not work.
Respectfully,
Saku -
-
@blackbull j’ai le meme soucis. quand tu dis le dossier spécifique du module, c’est par exemple dans MMM-moonraker ou dans MMM-moonraker/node_modules?
Merci d’avance.
-
@myayo001 did you see this above
-
@sdetweil oui j’ai vu le post je dois installer npm install node-fetch@2
je l’ai installer dans le dossier MMM-moonraker et j’ai toujours l’erreur -
@sdetweil cela arrive quand la version principale de node est v10.x et que l’utilisateur demande la version v20 ou v22 avec la commande
n
généralement resolu avec la version principale de node en v20. ensuite on peux utiliser
n
comme on a envie -
@bugsounet je n 'ai pas trop compris ce que je devais faire.
mais j’ai bien node v20Mirror $ node -v
v20.18.1
-
@myayo001 Just remove the the line
const fetch = require("fetch");
in the filenode-helper.js
in the module’s directory. -
merci ca fonctionne maintenant!