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.

    Cannot find module 'node-fetch' error with MMM-SoccerLiveScore

    Scheduled Pinned Locked Moved Solved Troubleshooting
    34 Posts 5 Posters 16.1k Views 5 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.
    • C Offline
      codac
      last edited by

      Running @karsten13 Docker karsten13/magicmirror with the module MMM-SoccerLiveScore from @0m4r results in an error “Cannot find module ‘node-fetch’”.

      2024/01/02 19:18:29	stderr	[02.01.2024 19:18.29.537] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
      2024/01/02 19:18:29	stderr	[02.01.2024 19:18.29.537] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
      2024/01/02 19:18:29	stderr	}
      2024/01/02 19:18:29	stderr	  ]
      2024/01/02 19:18:29	stderr	    '/opt/magic_mirror/serveronly/index.js'
      2024/01/02 19:18:29	stderr	    '/opt/magic_mirror/js/app.js',
      2024/01/02 19:18:29	stderr	    '/opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js',
      2024/01/02 19:18:29	stderr	  requireStack: [
      2024/01/02 19:18:29	stderr	  code: 'MODULE_NOT_FOUND',
      2024/01/02 19:18:29	stderr	    at async App.start (/opt/magic_mirror/js/app.js:259:3) {
      2024/01/02 19:18:29	stderr	    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      2024/01/02 19:18:29	stderr	    at loadModules (/opt/magic_mirror/js/app.js:211:10)
      2024/01/02 19:18:29	stderr	    at loadModule (/opt/magic_mirror/js/app.js:181:19)
      2024/01/02 19:18:29	stderr	    at require (node:internal/modules/helpers:176:18)
      2024/01/02 19:18:29	stderr	    at Module.require (node:internal/modules/cjs/loader:1235:19)
      2024/01/02 19:18:29	stderr	    at Module._load (node:internal/modules/cjs/loader:1023:12)
      2024/01/02 19:18:29	stderr	    at Module.load (node:internal/modules/cjs/loader:1207:32)
      2024/01/02 19:18:29	stderr	    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
      2024/01/02 19:18:29	stderr	    at Module._compile (node:internal/modules/cjs/loader:1376:14)
      2024/01/02 19:18:29	stderr	    at Object.<anonymous> (/opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js:10:15)
      2024/01/02 19:18:29	stderr	    at require (node:internal/modules/helpers:176:18)
      2024/01/02 19:18:29	stderr	    at Module.require (node:internal/modules/cjs/loader:1235:19)
      2024/01/02 19:18:29	stderr	    at Module._load (node:internal/modules/cjs/loader:985:27)
      2024/01/02 19:18:29	stderr	    at Module._resolveFilename (/opt/magic_mirror/node_modules/module-alias/index.js:49:29)
      2024/01/02 19:18:29	stderr	    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
      2024/01/02 19:18:29	stderr	- /opt/magic_mirror/serveronly/index.js
      2024/01/02 19:18:29	stderr	- /opt/magic_mirror/js/app.js
      2024/01/02 19:18:29	stderr	- /opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js
      2024/01/02 19:18:29	stderr	Require stack:
      2024/01/02 19:18:29	stderr	[02.01.2024 19:18.29.537] [ERROR] Error: Cannot find module 'node-fetch'
      2024/01/02 19:18:29	stderr	[02.01.2024 19:18.29.533] [ERROR] Whoops! There was an uncaught exception... 
      

      Any ideas about how to fix this?

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

        @karsten13 said in Cannot find module 'node-fetch' error with MMM-SoccerLiveScore:

        NODE_ENV=test npm install node-fetch@2

        I could see that this time node-fetch got installed (different than before running npm install node-fetch@2 only).
        But after restarting the docker container, the same error remained.

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

          @codac you have to go into the docker container, in the MM module folder and do
          npm install node-fetch@2

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @sdetweil
            Thank you for the quick reply.
            Found that solution already in the forum.
            Result is though:

            up to date, audited 1 package in 2s                                              
                                                                                             
            found 0 vulnerabilities
            

            After restarting the docker container, the error remains.

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

              @codac then you didnt do the npm install in the correct module folder
              and I assume you have to restart MM of the container to pick up the change

              Sam

              How to add modules

              learning how to use browser developers window for css changes

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

                @sdetweil

                root@04492d039b9f:/opt/magic_mirror/modules# cd MMM-SoccerLiveScore              
                root@04492d039b9f:/opt/magic_mirror/modules/MMM-SoccerLiveScore# npm install node
                -fetch@2                                                                         
                                                                                                 
                up to date, audited 1 package in 1s                                              
                                                                                                 
                found 0 vulnerabilities                                                         
                

                How would I restart MM of the container?
                pm2 is not set up.

                DISPLAY=:0 npm restart
                

                …results in

                > magicmirror@2.26.0 restart                                                     
                > npm stop --if-present && npm start                                             
                                                                                                 
                                                                                                 
                > magicmirror@2.26.0 start                                                       
                > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js           
                                                                                                 
                sh: 1: ./node_modules/.bin/electron: not found   
                
                S C 2 Replies Last reply Reply Quote 0
                • S Offline
                  sdetweil @codac
                  last edited by

                  @codac seen this happening more

                  in the container again
                  in the MagicMirror folder do

                  npm install electron@27.2.0
                  

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

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

                    @sdetweil
                    sorry for the hussle, but this seems to never end :anguished_face:

                    after running

                    npm install electron@27.2.0
                    

                    I tried to restart MM:

                    root@04492d039b9f:/opt/magic_mirror# DISPLAY=:0 npm restart                      
                                                                                                     
                    > magicmirror@2.26.0 restart                                                     
                    > npm stop --if-present && npm start                                             
                                                                                                     
                                                                                                     
                    > magicmirror@2.26.0 start                                                       
                    > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js           
                                                                                                     
                    /opt/magic_mirror/node_modules/electron/dist/electron: error while loading shared
                     libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or 
                    directory                                                           
                    
                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @codac
                      last edited by

                      @codac yeh, seems that electron needs something from the container
                      do you know which container you are using?

                      @karsten13 can u look at this

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

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

                        @sdetweil

                        he must restart the container, this cannot be done from inside the container

                        so how was the container started? With docker compose oder docker run ... or?

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

                          @karsten13 this

                          libgobject-2.0.so.0: cannot open shared object file: No such file or directory                                                           
                          

                          will be fixed by container restart ?

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

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

                            @sdetweil

                            I don’t now, the old electron process is still running

                            but we now nothing, how he started, in server only or with electron, which architecture, which host os, which hardware …

                            C 1 Reply Last reply Reply Quote 0
                            • C Offline
                              codac @karsten13
                              last edited by

                              @karsten13

                              docker run
                              
                              1 Reply Last reply Reply Quote 0
                              • C Offline
                                codac @sdetweil
                                last edited by

                                @sdetweil
                                This error only comes up when trying to restart MM inside the docker.
                                When restarting the docker, this error wont show up.

                                1 Reply Last reply Reply Quote 1
                                • C Offline
                                  codac @karsten13
                                  last edited by

                                  @karsten13
                                  This is a server only setup. Docker runs on “Container Manager” of Synology. The Synology is a DS420+ running on an INTEL Celeron J4025. The OS is DSM of course.

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

                                    @codac

                                    and how do you start/stop the container? With a WebUI or per command line?

                                    C 1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      codac @karsten13
                                      last edited by

                                      @karsten13 WebUI

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

                                        @codac and I think the electron error is just noise, as you must be running server only mode, whcih doesn’t use electron

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

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

                                          @codac

                                          I don’t know this WebUI, you have to restart the container or stop and start again, whatever the WebUI provides

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

                                            @sdetweil

                                            and I think the electron error is just noise, as you must be running server only mode, whcih doesn’t use electron

                                            yes, there is no electron installed

                                            1 Reply Last reply Reply Quote 0
                                            • C Offline
                                              codac @karsten13
                                              last edited by

                                              @karsten13 well restarting / stopping / starting is no problem. But the error just remains and doesnt go away…

                                              S 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
                                              • 2 / 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