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.

    electron-rebuild problems with MagicMirror 2.22.0

    Scheduled Pinned Locked Moved Solved Troubleshooting
    53 Posts 5 Posters 23.4k Views 6 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.
    • wishmaster270W Offline
      wishmaster270 Module Developer @KristjanESPERANTO
      last edited by

      @KristjanESPERANTO

      Hi and thank you for contributing. I confirm that changing to magicmirror-rebuild did not make things batter but worse. I now followed the suggestion of @sdetweil and implemented his postinstall script. Things are working perfectly now and should work in future releases, too.

      I merged the new changes to the master a few minutes ago and released version 0.0.7 of MMM-GPIO-Notifications. I will implement this approach in my other modules, too.

      KristjanESPERANTOK 1 Reply Last reply Reply Quote 0
      • KristjanESPERANTOK Offline
        KristjanESPERANTO Module Developer @wishmaster270
        last edited by KristjanESPERANTO

        @wishmaster270 OK, you’re welcome.

        Since the thread is also for other developers: I recommend considering my approach, as I consider the other approach (installing to a higher-level directory) to be more error-prone. But it’s a creative workaround.

        wishmaster270W 1 Reply Last reply Reply Quote 0
        • wishmaster270W Offline
          wishmaster270 Module Developer @KristjanESPERANTO
          last edited by wishmaster270

          @KristjanESPERANTO
          The problem with installing it in the module directory is that we need to compile the library against the electron version installed in the MagicMirror project.
          If electron-rebuild is installed in the module directory it might fail to detect the right electron version (which was the cause of the rebuild problems in the past).
          So the right way is to install electron-rebuild in the same project as electron and call it from there.

          It might be worth to think about adding it as a dependency in the main project.

          KristjanESPERANTOK karsten13K 2 Replies Last reply Reply Quote 1
          • KristjanESPERANTOK Offline
            KristjanESPERANTO Module Developer @wishmaster270
            last edited by KristjanESPERANTO

            @wishmaster270 Okay, thanks for the explanation! I haven’t been able to read that anywhere in such clear words and I haven’t dealt with the past problems. Then I withdraw my recommendation because I lack the overview.

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

              @KristjanESPERANTO ah I see

              haven’t heard of @electron/rebuild

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • karsten13K Offline
                karsten13 @wishmaster270
                last edited by

                @wishmaster270 said in electron-rebuild problems with MagicMirror 2.22.0:

                So the right way is to install electron-rebuild in the same project as electron and call it from there.

                installing module stuff in the node_modules folder of mm is a hack and will not work out of the box with a docker setup because this folder is only in the container (you have to map it on the host to get changes there persistent)

                It might be worth to think about adding it as a dependency in the main project.

                in this case may the best solution

                S 2 Replies Last reply Reply Quote 0
                • S Offline
                  sdetweil @karsten13
                  last edited by

                  @karsten13 yes, that’s what I think we come to but doesn’t help any existing broken modules

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @karsten13 docker is a pita with this stuff. too much/not enough in the container. which is supposed to be immutable.

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • KristjanESPERANTOK Offline
                      KristjanESPERANTO Module Developer @sdetweil
                      last edited by KristjanESPERANTO

                      @sdetweil As a soft step, the broken modules could switch to @electron/rebuild. This should also work for docker.

                      wishmaster270W S 2 Replies Last reply Reply Quote 0
                      • wishmaster270W Offline
                        wishmaster270 Module Developer @KristjanESPERANTO
                        last edited by wishmaster270

                        @KristjanESPERANTO

                        I have a docker installation running for development here on my notebook.
                        Everytime a module needs “npm install” I exec to the container and run the command in the container cause there will be called the correct npm and node version in the container and not the ones I currently use on my notebook.
                        In this case the directory structure is the same as with a locally installed MagicMirror and the postinstall script will work as excepted.

                        karsten13K 1 Reply Last reply Reply Quote 1
                        • karsten13K Offline
                          karsten13 @wishmaster270
                          last edited by karsten13

                          @wishmaster270 said in electron-rebuild problems with MagicMirror 2.22.0:

                          and the postinstall script will work as excepted.

                          yes, will work, but all the changes in the node_modules folder of mm are gone with the next restart of the container …

                          wishmaster270W 1 Reply Last reply Reply Quote 0
                          • wishmaster270W Offline
                            wishmaster270 Module Developer @karsten13
                            last edited by

                            @karsten13
                            In case of electron-rebuild this is no problem as it is only required during compile but not at runtime.

                            karsten13K 1 Reply Last reply Reply Quote 0
                            • karsten13K Offline
                              karsten13 @wishmaster270
                              last edited by

                              @wishmaster270

                              o.k., but where are the compile results stored?

                              wishmaster270W 1 Reply Last reply Reply Quote 0
                              • wishmaster270W Offline
                                wishmaster270 Module Developer @karsten13
                                last edited by wishmaster270

                                @karsten13
                                They are stored in the node_modules folder of the module which should be persistent

                                Edit: Do not misunderstand me. In my opinion the best way to solve the electron-rebuild problems of a lot of modules would be to put “@electron/rebuild” as a dependency to “package.json” of MagicMirror.

                                karsten13K 2 Replies Last reply Reply Quote 0
                                • karsten13K Offline
                                  karsten13 @wishmaster270
                                  last edited by

                                  @wishmaster270 said in electron-rebuild problems with MagicMirror 2.22.0:

                                  @karsten13
                                  They are stored in the node_modules folder of the module which should be persistent

                                  thats good, so the construction with installing electron-rebuild in mm folder has no side effects and works also in a docker setup.

                                  1 Reply Last reply Reply Quote 0
                                  • karsten13K Offline
                                    karsten13 @wishmaster270
                                    last edited by

                                    @wishmaster270 said in electron-rebuild problems with MagicMirror 2.22.0:

                                    Edit: Do not misunderstand me. In my opinion the best way to solve the electron-rebuild problems of a lot of modules would be to put “@electron/rebuild” as a dependency to “package.json” of MagicMirror.

                                    I don’t have a final opinion on that yet, but if so, we should put it under optionalDependencies as electron

                                    wishmaster270W S 2 Replies Last reply Reply Quote 1
                                    • wishmaster270W Offline
                                      wishmaster270 Module Developer @karsten13
                                      last edited by

                                      @karsten13

                                      You are right. I think optionalDependencies would be a great solution. Module developers could then add a hint to run npm ci in the MagicMirror directory to their installations instructions.

                                      As the container it self is untouched it should be no problem. It only causes @electron/rebuild to be installed the next time the script is called.

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

                                        @KristjanESPERANTO but if u look at electron/rebuild after install u call electron-rebuild

                                        still has to be installed in the base node_modules folder…

                                        older unmaintained modules are broken either way. why I had to fork MMM-Buttons.

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

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

                                          @wishmaster270 optional is there so that IF electron is NOT installed, the install does not fail (needed on pi0w at least)
                                          have nothing to do w ci

                                          my script ONLY installs prod, no dev. as 99.5% of users are users not mm developers. has nothing to do w module developers

                                          Sam

                                          How to add modules

                                          learning how to use browser developers window for css changes

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

                                            @karsten13 and the postinstall checks for it being there, and if so skips the e-r install.

                                            doesn’t know/care HOW it got installed before

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            karsten13K 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • 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