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.

    MMM-ModuleToggleButton suddenly broken?

    Scheduled Pinned Locked Moved Solved Troubleshooting
    15 Posts 2 Posters 1.2k 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.
    • S Offline
      sdetweil @philie
      last edited by sdetweil

      @philie yep, the tools aren’t installed
      and it needs more changes

      I won’t be able to get to it til later tonight
      but if you look at my fork for MMM-Buttons
      https://github.com/sdetweil/MMM-Buttons

      I added a postinstall action in package json and added the postinstall script

      you can run the postinstall without npm

      ./postinstall
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      P 1 Reply Last reply Reply Quote 0
      • P Offline
        philie @sdetweil
        last edited by

        @sdetweil
        Hey Sam
        Thank you very much.
        To keep it simple, I installed your MMM-Buttons. The postinstall Script did run and I got positive Feedback regarding rebuilding Electron.

        When i start MM after, I get still the same Error as before…

        philie@magicmirror:~/MagicMirror $ cat somfile.txt
        
        > magicmirror@2.26.0 start
        > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
        
        [15.02.2024 11:40.59.323] [LOG]   Starting MagicMirror: v2.26.0
        [15.02.2024 11:40.59.334] [LOG]   Loading config ...
        [15.02.2024 11:40.59.345] [DEBUG] config template file not exists, no envsubst
        [15.02.2024 11:40.59.353] [LOG]   Loading module helpers ...
        [15.02.2024 11:40.59.410] [ERROR] (node:1536) UnhandledPromiseRejectionWarning: Error: The module '/home/philie/node_modules/epoll/build/Release/epoll.node'
        was compiled against a different Node.js version using
        NODE_MODULE_VERSION 115. This version of Node.js requires
        NODE_MODULE_VERSION 118. Please try re-compiling or re-installing
        the module (for instance, using `npm rebuild` or `npm install`).
            at process.func [as dlopen] (node:electron/js2c/node_init:2:2107)
            at Object.<anonymous> (node:internal/modules/cjs/loader:1356:18)
            at Object.func [as .node] (node:electron/js2c/node_init:2:2107)
            at Module.load (node:internal/modules/cjs/loader:1126:32)
            at node:internal/modules/cjs/loader:967:12
            at Function._load (node:electron/js2c/node_init:2:13357)
            at Module.require (node:internal/modules/cjs/loader:1150:19)
            at require (node:internal/modules/cjs/helpers:121:18)
            at bindings (/home/philie/node_modules/bindings/bindings.js:112:48)
            at /home/philie/node_modules/epoll/epoll.js:7:31
            at Object.<anonymous> (/home/philie/node_modules/epoll/epoll.js:15:3)
            at Module._compile (node:internal/modules/cjs/loader:1271:14)
            at Object..js (node:internal/modules/cjs/loader:1326:10)
            at Module.load (node:internal/modules/cjs/loader:1126:32)
            at node:internal/modules/cjs/loader:967:12
            at Function._load (node:electron/js2c/node_init:2:13357)
        (Use `electron --trace-warnings ...` to show where the warning was created)
        [15.02.2024 11:40.59.412] [ERROR] (node:1536) 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: 2)
        /home/philie/MagicMirror/node_modules/electron/dist/electron exited with signal SIGINT
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @philie
          last edited by

          @philie ok, two things…

          1 lets fix the epoll problem.
          it seems that was installed accidentally in the wrong place as its outside the MagicMirror folder

          /home/philie/node_modules/epoll
          

          do

          cd ~
          rm -rf node_modules/epoll
          

          2 use my fork of the MMM-ModuleToggleButton module which fixes the install
          https://github.com/sdetweil/MMM-ModuleToggleButton

          remove the old module folder, clone my fork and npm install it

          cd ~/MagicMirror/modules
          rm -rf MMM-ModuleToggleButton
          git clone https://github.com/sdetweil/MMM-ModuleToggleButton
          cd MMM-ModuleToggleButton
          npm install
          

          let me know

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          P 1 Reply Last reply Reply Quote 0
          • P Offline
            philie @sdetweil
            last edited by

            @sdetweil
            Great! Module ist now installed fine and the test-confg (just the toggle module and another one to toggle activated) is working!

            Very much appreciated what you are doing for this community! Thank you!

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

              @philie awesome!!!

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • P Offline
                philie
                last edited by

                @sdetweil said in MMM-ModuleToggleButton suddenly broken?:

                cd MMM-ModuleToggleButton

                Hey there, it’s me again with the same problem…

                I did the MM Update to 2.28.0 by Script. Like usually some things are broken after and I did npm install and npm rebuild in the MM rootdirectory. It installed some stuff and looked good so far.

                But the module MMM-ModuleToggleButton stays broken like after every update.
                It has again something to do with electron, I tried to reinstall electron, but have no success…

                The output:

                philie@magicmirror:~/MagicMirror/modules $ git clone https://github.com/sdetweil/MMM-ModuleToggleButton
                Cloning into 'MMM-ModuleToggleButton'...
                remote: Enumerating objects: 44, done.
                remote: Counting objects: 100% (4/4), done.
                remote: Compressing objects: 100% (4/4), done.
                remote: Total 44 (delta 0), reused 2 (delta 0), pack-reused 40
                Receiving objects: 100% (44/44), 10.44 KiB | 1.30 MiB/s, done.
                Resolving deltas: 100% (17/17), done.
                philie@magicmirror:~/MagicMirror/modules $ cd MMM-ModuleToggleButton
                philie@magicmirror:~/MagicMirror/modules/MMM-ModuleToggleButton $ npm install
                
                > MMM-ModuleToggleButton@1.0.0 postinstall
                > ./postinstall
                
                /home/philie/MagicMirror/modules/MMM-ModuleToggleButton
                ./postinstall: line 8: ../../node_modules/.bin/electron-rebuild: No such file or directory
                npm error code 127
                npm error path /home/philie/MagicMirror/modules/MMM-ModuleToggleButton
                npm error command failed
                npm error command sh -c ./postinstall
                npm error A complete log of this run can be found in: /home/philie/.npm/_logs/2024-07-14T11_29_32_616Z-debug-0.log
                philie@magicmirror:~/MagicMirror/modules/MMM-ModuleToggleButton $
                

                so, electron-rebuild in node_modules seems to be missing…

                Indeed:

                philie@magicmirror:~/MagicMirror/node_modules $ cd electron
                philie@magicmirror:~/MagicMirror/node_modules/electron $ ll
                total 1068
                drwxr-xr-x   4 root   root     4096 Jul 14 13:20 .
                drwxr-xr-x 679 philie philie  28672 Jul 14 13:10 ..
                -rw-r--r--   1 root   root     8126 Jul 14 12:46 checksums.json
                -rwxr-xr-x   1 root   root      612 Jul 14 12:46 cli.js
                drwxr-xr-x   4 root   root     4096 Jul 14 12:48 dist
                -rw-r--r--   1 root   root   972754 Jul 14 12:46 electron.d.ts
                -rw-r--r--   1 root   root      659 Jul 14 12:46 index.js
                -rw-r--r--   1 root   root     3178 Jul 14 12:46 install.js
                -rw-r--r--   1 root   root     1096 Jul 14 12:46 LICENSE
                drwxr-xr-x  70 root   root     4096 Jul 14 13:20 node_modules
                -rw-r--r--   1 root   root      586 Jul 14 12:46 package.json
                -rw-r--r--   1 root   root    31409 Jul 14 13:20 package-lock.json
                -rw-r--r--   1 root   root        8 Jul 14 12:48 path.txt
                -rw-r--r--   1 root   root     5370 Jul 14 12:46 README.md
                

                I did already the steps from last time (therefore I answer in this old topic) but no luck this time.
                What can I do?

                Thank you,
                philie

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

                  @philie can you dump out the postinstall
                  file in the module folder…
                  it seems to be missing a step

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @philie I see the postinstall script needed an update

                    do a
                    git pull
                    in the module folder
                    then
                    npm install again

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    P 1 Reply Last reply Reply Quote 0
                    • P Offline
                      philie @sdetweil
                      last edited by

                      @sdetweil
                      Thank you Sam!
                      the edited script did not work for me but the commands worked. so I executed them manually:

                      philie@magicmirror:~/MagicMirror $ sudo npm install @electron/rebuild
                      
                      added 88 packages, and removed 74 packages in 25s
                      
                      220 packages are looking for funding
                        run `npm fund` for details
                      philie@magicmirror:~/MagicMirror $ node_modules/.bin/electron-rebuild
                      ✔ Rebuild Complete
                      philie@magicmirror:~/MagicMirror $
                      

                      unfortunately the next issue is already on the dorstep:

                      message:14:59:24.366] [ERROR] (node:2306) UnhandledPromiseRejectionWarning: Error: The module '/home/philie/MagicMirror/modules/MMM-ModuleToggleButton/node_modules/epoll/build/Release/epoll.node',
                      

                      So it looks like the thing about epoll is not yet solved…

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

                        @philie never use sudo…

                        the electron-rebuild command has to be done from inside the module folder(togglebuttons), not the MagicMirror folder

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        P 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • 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