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.

    Default Weather module still not displaying

    Scheduled Pinned Locked Moved Solved Troubleshooting
    39 Posts 6 Posters 16.3k 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.
    • S Do not disturb
      sdetweil @Jarhead96097
      last edited by

      @Jarhead96097 use my install script

      see
      https://github.com/sdetweil/MagicMirror_scripts

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • Jarhead96097J Offline
        Jarhead96097 @Jarhead96097
        last edited by

        @sdetweil “On branch master,” and up to date with origin/master. I also meant to reply earlier that this is on a RPI 4B. Unfortunately, still getting the same error and the weather module is not displaying information.

        I appreciate everyone’s time…but I’m going to cut to the chase and rebuild using your install script.

        Thanks again for the time, you’re always very helpful, and I appreciate it.

        Jarhead96097

        S 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil @Jarhead96097
          last edited by

          @Jarhead96097 ah, one other question, what is the current node level

          node --version

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          Jarhead96097J B 2 Replies Last reply Reply Quote 1
          • Jarhead96097J Offline
            Jarhead96097 @sdetweil
            last edited by

            @sdetweil sorry, already using your installation script (but no “npm audit fix” this time around).

            Jarhead96097

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

              @sdetweil On my RPi4 it’s 16.16.0, and I’m getting the same problems as Jarhead. After an upgrade there’s now just no reaction to starting mm.

              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @Blackeye
                last edited by

                @Blackeye can u show the output of the npm start or, if using pm2 , then

                pm2 logs --lines=50

                how did u do the upgrade?

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S B 2 Replies Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @sdetweil
                  last edited by

                  @Blackeye also, can u show me the contents of line 159 from

                  ~/MagicMirror/modules/default/weather/weather.js
                  

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  Jarhead96097J 1 Reply Last reply Reply Quote 0
                  • Jarhead96097J Offline
                    Jarhead96097 @OldSunGuy
                    last edited by

                    @OldSunGuy I use the MMM-ModuleScheduler 3rd party module to control when my MM turns off everything except the clock and dims the display at night. “daytime_scheduler” is the class I used to turn off those modules at night.

                    Jarhead96097

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

                      @sdetweil here is what my weather.js (newly rebuilt, but not yet configured) has on lines 148 to 166:

                      	// What to do when the weather provider has new information available?
                      	updateAvailable: function () {
                      		Log.log("New weather information available.");
                      		this.updateDom(0);
                      		this.scheduleUpdate();
                      
                      		if (this.weatherProvider.currentWeather()) {
                      			this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
                      		}
                      
                      		const notificationPayload = {
                      			currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
                      			forecastArray: this.weatherProvider?.weatherForecastArray?.map((ar) => ar.simpleClone()) ?? [],
                      			hourlyArray: this.weatherProvider?.weatherHourlyArray?.map((ar) => ar.simpleClone()) ?? [],
                      			locationName: this.weatherProvider?.fetchedLocationName,
                      			providerName: this.weatherProvider.providerName
                      		};
                      		this.sendNotification("WEATHER_UPDATED", notificationPayload);
                      	},
                      

                      Jarhead96097

                      Jarhead96097J S 2 Replies Last reply Reply Quote 0
                      • Jarhead96097J Offline
                        Jarhead96097 @Jarhead96097
                        last edited by

                        @sdetweil Sam, thanks for all of your help. I’ve finished rebuilding without running ‘npm audit fix’ and everything is working as it should! I used your installation script and everything worked fine. I also took the opportunity to move things around and try a couple of new 3rd party modules… everything is back to normal!

                        Thanks again,
                        Jarhead96097

                        Jarhead96097

                        S 1 Reply Last reply Reply Quote 1
                        • S Do not disturb
                          sdetweil @Jarhead96097
                          last edited by

                          @Jarhead96097 said in Default Weather module still not displaying:

                            const notificationPayload = {
                            	currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
                          

                          thats line 158 and159.

                          the only thing i can think of is the ?. (optional chaining) operator…
                          but its been long supported… and it works on my 16.9.1 node version

                          see item 2 in the list here
                          https://www.freecodecamp.org/news/how-the-question-mark-works-in-javascript/

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply Reply Quote 0
                          • S Do not disturb
                            sdetweil @Jarhead96097
                            last edited by

                            @Jarhead96097 great news!!!

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

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

                              @sdetweil Moin, line 159 of weather-js looks like this:

                              currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
                              

                              The pm2 error log shows:

                              /home/<myusername>/.pm2/logs/MagicMirror-error.log last 50 lines:
                              1|MagicMir | failed to load swrast driver
                              1|MagicMir | [06.08.2022 09:46.00.374] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: The module '/home/lookyhere/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/build/Release/epoll.node'
                              1|MagicMir | was compiled against a different Node.js version using
                              1|MagicMir | NODE_MODULE_VERSION 73. This version of Node.js requires
                              1|MagicMir | NODE_MODULE_VERSION 107. Please try re-compiling or re-installing
                              1|MagicMir | the module (for instance, using `npm rebuild` or `npm install`).
                              

                              Looks like I should re-install. Which is the best method, in your opinion?
                              Many thanks for your help - I want to get this thing on the wall soon!

                              S 1 Reply Last reply Reply Quote 0
                              • S Do not disturb
                                sdetweil @Blackeye
                                last edited by

                                @Blackeye see

                                https://forum.magicmirror.builders/topic/16074/electron-rebuild-and-magicmirror-v2-18-and-more?page=1

                                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
                                  Blackeye @sdetweil
                                  last edited by

                                  @sdetweil Hi Sam, Many thanks for the suggestion - I followed your advice on that page. Here’s what happened halfway through:

                                  from ../src/epoll.cc:11:
                                  /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/20.0.1/include/node/v8-ma                                     ybe.h:106:45: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_                                     reference’?
                                    106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                        |                                             ^~~~~~~~~~~~~~~~~~~~~
                                        |                                             is_lvalue_reference
                                  /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/20.0.1/include/node/v8-ma                                     ybe.h:106:66: warning: logical not is only applied to the left hand side of comparison [-Wlogic                                     al-not-parentheses]
                                    106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                        |                                                                  ^
                                  /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/20.0.1/include/node/v8-ma                                     ybe.h:106:67: error: template argument 1 is invalid
                                    106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                        |                                                                   ^
                                  /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/20.0.1/include/node/v8-ma                                     ybe.h:106:71: error: expected unqualified-id before ‘>’ token
                                    106 |   template <class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
                                        |                                                                       ^
                                  /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll/20.0.1/include/node/v8-ma                                     ybe.h:123:43: error: ‘is_lvalue_reference_v’ is not a member of ‘std’; did you mean ‘is_lvalue_                                     reference’?
                                    123 | template <class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* = nullptr>
                                  
                                  

                                  and finally:

                                  ✖ MagicMirror Rebuild Failed
                                  
                                  An unhandled error occurred inside electron-rebuild
                                  node-gyp failed to rebuild '/home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epo                                     ll'.
                                  Error: `make` failed with exit code: 2
                                  

                                  This will all mean a lot more to you than it does for me.

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

                                    @sdetweil And this is the final part of the error message, in bright red:

                                     at ModuleRebuilder.rebuildNodeGypModule (/home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor                                     /node_modules/magicmirror-rebuild/build/module-rebuilder.js:193:19)
                                        at processTicksAndRejections (node:internal/process/task_queues:96:5)
                                        at async Rebuilder.rebuildModuleAt (/home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node                                     _modules/magicmirror-rebuild/build/rebuild.js:180:9)
                                        at async Rebuilder.rebuild (/home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules                                     /magicmirror-rebuild/build/rebuild.js:143:17)
                                        at async /home/<myusername>/MagicMirror/modules/MMM-PIR-Sensor/node_modules/magicmirror-rebuil                                     d/build/cli.js:141:9
                                    
                                    
                                    S 2 Replies Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @Blackeye
                                      last edited by

                                      @Blackeye hm. 1st time I’ve seen his tools fail…

                                      @bugsounet any guidance

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      bugsounetB 1 Reply Last reply Reply Quote 0
                                      • bugsounetB Offline
                                        bugsounet Banned @sdetweil
                                        last edited by bugsounet

                                        @sdetweil yes

                                        epoll/20.0.1 means it uses electron v20.0.1 for MagicMirror instead of v19.x that why it crash.

                                        I’ll leave it up to you to explain it :)

                                        1 Reply Last reply Reply Quote 0
                                        • S Do not disturb
                                          sdetweil @Blackeye
                                          last edited by sdetweil

                                          @Blackeye ok, heres a way around the problem

                                          fix MM install to have one new tool

                                          cd ~/MagicMirror
                                          npm install electron-rebuild
                                          

                                          fix MMM-PIR-Sensor

                                          cd ~/MagicMirror/modules/MMM-PIR-Sensor
                                          nano package.json 
                                          

                                          scroll down to

                                            "scripts": {
                                              "postinstall": "node_modules/.bin/electron-rebuild -e ../../node_modules/electron"
                                            },
                                          

                                          change the postinstall line so it looks like this

                                            "scripts": {
                                              "postinstall": "~/MagicMirror/node_modules/.bin/electron-rebuild -e ../../node_modules/electron"
                                            },
                                          

                                          ctrl-o to save the updated package.json
                                          ctrl-x to exit the editor

                                          then

                                          npm install
                                          

                                          should work correctly now

                                          I just tested this on my MM 2.20 version, on both my linux machine and my pi4 with bullseye

                                          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
                                            Blackeye @sdetweil
                                            last edited by Blackeye

                                            @sdetweil said in Default Weather module still not displaying:

                                            ~/MagicMirror/node_modules/.bin/electron-rebuild -e …/…/node_modules/electron

                                            Yes! It installed correctly this time, so that change in the path did the trick. I did get some warnings however:

                                            npm WARN deprecated har-validator@5.1.5: this library is no longer supported
                                            npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain cir                                 cumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
                                            npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
                                            

                                            So it is not quite a perfect solution, but it works!
                                            Many thanks for the suggestions and the solution!

                                            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