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.

    Error on starting MM2: module not present

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    22 Posts 2 Posters 9.3k 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 @MWel1977
      last edited by

      @mwel1977 npm is the Node Package Manager. It makes sure all the env is right (read package.json), then launches node to execute the startup script.

      You can code different actions, and then tell npm to execute that action.

      foobar: some command

      Then npm foobar will execute that command

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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

        @sdetweil is npm then the compiler?
        If so how can I recompile the mmm-usonic module so it works with my current Node.js version?
        Is there somewere documentation on how this npm works and how all the modules are tide in it?

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

          npm --help should give you the options…

          from MM,

          npm rebuild MMM-usonic 
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @sdetweil And do I have to be in a specific folder for this command (in the npm home folder or the mmm-usonic for instance)?
            Or can I just type it in the terminal from the start (/Home/Pi/)?
            That is what I still don’t quite get. What command must be used in what (folder) location.
            But I’ll try that command tonight at home.
            (I have my 3B+ with me here at work (that has the “working” MM2 on it. At home I have the Pi 3A+ attached to the 7" touchscreen and has the “test enviroment” of my MM2 on it. So when something works on the 3A+ (and I know how to do it right) I can do it first time right on the 3B+.:smiling_face_with_open_mouth_smiling_eyes: )

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

              @mwel1977 well, you can be in many different places…

              npm install (no other parms) will install the module in the current folder, so this could be MagicMirror (for all using modules), OR it could be in the MMM-Swipe folder only (then only available for MMM-Swipe)

              or you can add -g parm, and regardless of the current folder, it is added to the system wide node_modules, so it is available for any/all applications that want/need to use it.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

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

                @sdetweil may I ask you were you think that mmm-usonic module should be install in order for it to work with the mmm-swipe module?
                Reading what your telling me I’m starting to think it should be installed in the MMM-Swipe folder. However the error notification shows that it found the mmm-usonic module only it’s compiled with a wrong version.

                I’ll try you suggestion “npm rebuild MMM-usonic” tonight and from the folder “/Home/Pi/” and see what happens (If I understand you correctly I can also use just “npm rebuild” when I’m in the folder “/Home/Pi/node_modules/mmm-usonic/”).

                And I think I’ll start reading this after I’ve done that: https://docs.npmjs.com/ :grinning_face_with_smiling_eyes:
                Hope I’ll know more about npm afterwards.

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

                  where was it installed (check the MM/node-modules folder and the MM/modules/MMM-Swipe/node-modules folder…

                  rebuild where found…

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @sdetweil
                    Oh…crap! :flushed_face: I have a node_modules folder under Home/Pi
                    not under Home/Pi/MagicMirror.
                    Think I’ll format my micro SD card and start over. This time when I install something for the MM I’ll do it from the directory Home/Pi/MagicMirror.
                    Don’t think I can just “move” the content of the Home/Pi/node_modules to the MagicMirror folder can I? :weary_face:

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

                      @mwel1977 just erase the one in /home/pi (rm -rf node_modules) and then start from the MM folder,

                      then erase node_modules, then do npm install, then switch to MMM-Swipe and do npm install,
                      then npm rebuild MMM-usonic

                      no need to wipe and start over…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

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

                        @sdetweil If I understand you right:
                        #1 remove node_modules in “Home/Pi” and in “Home/Pi/MagicMirror” with command “rm -rf node_modules”
                        #2 re-install npm in the folder “Home/Pi/MagicMirror” and in “Home/Pi/MagicMirror/MMM-Swipe”
                        #3 then re-install the module mmm-usonic in the folder “Home/Pi/MagicMirror/MMM-Swipe”
                        #4 then rebuild the usonic module with “npm rebuild mmm-usonic”

                        I have doubt on where to install step 3. Should it go in the folder from the MagicMirror or from de module MMM-Swipe? Because I delete the module mmm-usonic with step 1. And I don’t know if this will be installed on re-installing the module MMM-Swipe.

                        But I’ll check that first thing tonight (if there is a module mmm-usonic being installed with MMM-Swipe). I think it should be installed with it as a dependency from MMM-Swipe.

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

                          @mwel1977 step 3, in the modules/MMM-Swipe folder,

                          npm install MMM-usonic
                          

                          Then same folder,

                          npm rebuild MMM-usonic
                          

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          M 2 Replies Last reply Reply Quote 1
                          • M Offline
                            MWel1977 @sdetweil
                            last edited by MWel1977

                            @sdetweil
                            Did it tonight. couldn’t make it yesterday.
                            So…did as we sad like above…yet it didn’t work.
                            This time something with electron. Here’s the terminal “output”:

                            pi@Mirror:~/MagicMirror/modules/MMM-Swipe $ npm install
                            npm WARN deprecated math-statistics@1.2.0: THIS PROJECT IS NO LONGER MAINTAINED by clebert
                            npm WARN deprecated expressive-assertion@1.5.1: THIS PROJECT IS NO LONGER MAINTAINED by clebert
                            npm WARN deprecated typesystem@5.0.0: THIS PROJECT IS NO LONGER MAINTAINED by clebert
                            
                            > mmm-gpio@3.0.2 install /home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-gpio
                            > node-gyp configure build
                            
                            make: Map '/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-gpio/build' wordt binnengegaan
                              CXX(target) Release/obj.target/gpio/src/gpio.o
                              CXX(target) Release/obj.target/gpio/src/node_gpio.o
                              SOLINK_MODULE(target) Release/obj.target/gpio.node
                              COPY Release/gpio.node
                            make: Map '/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-gpio/build' wordt verlaten
                            
                            > mmm-usonic@2.5.3 install /home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-usonic
                            > node-gyp configure build
                            
                            make: Map '/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-usonic/build' wordt binnengegaan
                              CXX(target) Release/obj.target/usonic/src/clock.o
                              CXX(target) Release/obj.target/usonic/../mmm-gpio/src/gpio.o
                              CXX(target) Release/obj.target/usonic/src/node_usonic.o
                              SOLINK_MODULE(target) Release/obj.target/usonic.node
                              COPY Release/usonic.node
                            make: Map '/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/mmm-usonic/build' wordt verlaten
                            
                            > MMM-Swipe@1.1.1 postinstall /home/pi/MagicMirror/modules/MMM-Swipe
                            > electron-rebuild -e ../../node_modules/electron-prebuilt
                            
                            
                            An unhandled error occurred inside electron-rebuild
                            Unable to find electron-prebuilt's version number, either install it or specify an explicit version
                            
                            Error: Unable to find electron-prebuilt's version number, either install it or specify an explicit version
                                at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:80:19)
                                at Generator.next (<anonymous>)
                                at /home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:8:71
                                at new Promise (<anonymous>)
                                at __awaiter (/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:4:12)
                                at /home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:69:8
                                at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-Swipe/node_modules/electron-rebuild/lib/src/cli.js:145:4)
                                at Module._compile (internal/modules/cjs/loader.js:654:30)
                                at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
                                at Module.load (internal/modules/cjs/loader.js:566:32)
                            npm ERR! code ELIFECYCLE
                            npm ERR! errno 255
                            npm ERR! MMM-Swipe@1.1.1 postinstall: `electron-rebuild -e ../../node_modules/electron-prebuilt`
                            npm ERR! Exit status 255
                            npm ERR! 
                            npm ERR! Failed at the MMM-Swipe@1.1.1 postinstall script.
                            npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
                            
                            npm ERR! A complete log of this run can be found in:
                            npm ERR!     /home/pi/.npm/_logs/2019-01-15T19_01_22_044Z-debug.log
                            pi@Mirror:~/MagicMirror/modules/MMM-Swipe $
                            

                            Can’t I just remove the MMM-Swipe module and reinstall it?

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

                              @sdetweil
                              Or can I better start clean and remove npm completely sudo npm uninstall npm -g and then reinstall?
                              I mean repearing all this could take longer than just simply uninstall and reinstall npm, MM2 and the few modules I have on this sd card. I just need the config.js file the store on a usb drive for when I’m done.

                              Or you think repearing that electron issue is a quick fix?:smiling_face_with_open_mouth_cold_sweat: :smiling_face_with_open_mouth_cold_sweat:

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

                                @mwel1977 said in Error on starting MM2: module not present:

                                Can’t I just remove the MMM-Swipe module and reinstall it?

                                sure… but u said that didn’t work before…

                                the package.json in MMM-Swipe is looking for electron version 1.2.1, very old…

                                I would edit the file before running npm install in the MMM-Swipe folder and chaneg the version to match
                                whatever electron verison is installed already…

                                MM/node_modules/electron/package.json

                                “version”: “2.0.13”

                                the MMM-Swipe package.json to

                                change

                                devDependencies": {
                                    "electron-rebuild": "^1.2.1"
                                  }
                                

                                to

                                devDependencies": {
                                    "electron-rebuild": "^x.y.z"  === the electron version number above
                                  }
                                

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

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

                                  @sdetweil
                                  I think I’ll just start over again with a reimage of the sd card.:persevering_face:
                                  I’ve checked the package.json file in the electron folder and it showed version 2.0.16
                                  So I entered that number at the bottom of the package.json file in the MMM-Swipe folder and run npm install again in the Swipe folder. Yet it gave me:

                                  pi@Mirror:~/MagicMirror/modules/MMM-Swipe $ npm install
                                  npm ERR! code ETARGET
                                  npm ERR! notarget No matching version found for electron-rebuild@^2.0.16
                                  npm ERR! notarget In most cases you or one of your dependencies are requesting
                                  npm ERR! notarget a package version that doesn't exist.
                                  npm ERR! notarget 
                                  npm ERR! notarget It was specified as a dependency of 'MMM-Swipe'
                                  npm ERR! notarget 
                                  
                                  npm ERR! A complete log of this run can be found in:
                                  npm ERR!     /home/pi/.npm/_logs/2019-01-15T22_09_44_953Z-debug.log
                                  pi@Mirror:~/MagicMirror/modules/MMM-Swipe $ 
                                  

                                  Thanks for helping me out so far.
                                  How do you know al this stuff? How long are you already doing this?
                                  Hope I’ll get that smart one day. :grinning_face:

                                  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
                                  • 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