MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Unable to run MMM-pihole-stats

    Scheduled Pinned Locked Moved Solved Troubleshooting
    4 Posts 2 Posters 500 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      BatterseaBridge
      last edited by

      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)
      (Use electron --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 information

      I’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.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @BatterseaBridge
        last edited by

        @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

        How to add modules

        learning how to use browser developers window for css changes

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          BatterseaBridge @sdetweil
          last edited by

          @sdetweil

          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

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @BatterseaBridge
            last edited by sdetweil

            @BatterseaBridge said in Unable to run MMM-pihole-stats:

            Why was that ‘different lib for node-fetch’

            well a couple of things

            1. the author used the mm copy without knowing
            2. we stopped providing it in this release, as we moved over to the built in fetch (aka supported) in node 18 and up
            3. 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

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy