Read the statement by Michael Teeuw here.
Unable to run MMM-pihole-stats
-
I’m running MM2.25 on a Raspberry Pi 3 and Pihole 5.17.2 on a Raspberry Pi 2. MM runs fine until I try to add the config.js settings required for MMM-pihole-stats. I’ve copied the module files to the MMM-pihole-stats module directory per the module instructions.
Here’s the error after launching MM:
[22.12.2023 10:32.45.964] [ERROR] (node:2558) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/merj/MagicMirror/node_modules/node-fetch/src/index.js from /home/merj/MagicMirror/modules/MMM-pihole-stats/node_helper.js not supported.
Instead change the require of index.js in /home/merj/MagicMirror/modules/MMM-pihole-stats/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. (/home/merj/MagicMirror/modules/MMM-pihole-stats/node_helper.js:2:15)
at Function._load (node:electron/js2c/asar_bundle:2:13327)
at loadModule (/home/merj/MagicMirror/js/app.js:180:19)
at loadModules (/home/merj/MagicMirror/js/app.js:210:10)
at async App.start (/home/merj/MagicMirror/js/app.js:258:3)
(Useelectron --trace-warnings ...
to show where the warning was created)
[22.12.2023 10:32.45.965] [ERROR] (node:2558) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[2558:1222/103246.592319:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device informationI’ve tried multiple config.js options according to the MMM-pihole-stats documentation and the error always remains the same. Glad to share config.js (which passes rpm run config:check test).
Thanks in advance.
-
@BatterseaBridge u need to load a different lib for node-fetch
cd ~/MagicMirror/modules/MMM-pihole-stats npm install node-fetch@2
restart MagicMirror
-
Sam, thank you so much! MM started right up with pihole stats no problem after installing the different lib. I spent days trying to troubleshoot this module.
Why was that ‘different lib for node-fetch’ missing from my original pihole module (or MagicMirror) install? I followed all of the module (and MM) instructions. A little frustrating!
Thanks again!
Mel
-
@BatterseaBridge said in Unable to run MMM-pihole-stats:
Why was that ‘different lib for node-fetch’
well a couple of things
- the author used the mm copy without knowing
- we stopped providing it in this release, as we moved over to the built in fetch (aka supported) in node 18 and up
- without a number, you get the latest, but we aren’t an es6 library based runtime. (import vs require)
most developers here are not professionals
so we ( I didn’t 5 yrs ago) didn’t understand all this dependency stuff