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.

    JavaScript error

    Scheduled Pinned Locked Moved Solved Troubleshooting
    28 Posts 2 Posters 385 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.
    • L Offline
      Lmagenis
      last edited by sdetweil

      Hi,

      I’d appreciate help with resolving this issue:

      Thank you!

      A JavaScript error occurred in the main process
      Uncaught Exception:
      TypeError: styleText is not a function
          at /home/pi/MagicMirror/js/logger.js:40:42
          at Object.<anonymous> (/home/pi/MagicMirror/js/logger.js:114:2)
          at Module._compile (node:internal/modules/cjs/loader:1141:14)
          at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
          at Module.load (node:internal/modules/cjs/loader:1011:32)
          at Module._load (node:internal/modules/cjs/loader:846:12)
          at f._load (node:electron/js2c/asar_bundle:2:13330)
          at Module.require (node:internal/modules/cjs/loader:1035:19)
          at require (node:internal/modules/cjs/helpers:102:18)
          at Object.<anonymous> (/home/pi/MagicMirror/js/app.js:7:13)
      
      S 1 Reply Last reply Reply Quote 0
      • L Offline
        Lmagenis @sdetweil
        last edited by

        @sdetweil got the new card up and running! Went through the scripts as you instructed but came up with a new error. Started the magic mirror in x11 and it works! Thanks again for your help! You’re indispensable!

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

          @Lmagenis can you tell us more?

          how did you install mm, or is this after an update?

          if it runs at all there is an info block output in the startup log

          if using pm2,

          pm2 stop all
          

          then

          cd ~/MagicMirror
          npm run server
          

          show the messages

          ctrl-c
          

          to stop mm

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          L 2 Replies Last reply Reply Quote 0
          • L Offline
            Lmagenis @sdetweil
            last edited by

            @sdetweil

            Hi! Thank you for your help!
            Here’s the output:
            [2026-05-11 08:50:20.288] [LOG] [app] Starting MagicMirror: v2.36.0
            [2026-05-11 08:50:20.301] [LOG] [utils] Loading config …
            [2026-05-11 08:50:20.310] [INFO] [utils] Checking config file /home/pi/MagicMirror/config/config.js …
            [2026-05-11 08:50:20.517] [INFO] [utils] Your configuration file doesn’t contain syntax errors :)
            [2026-05-11 08:50:20.519] [INFO] [utils] Checking modules structure configuration …
            [2026-05-11 08:50:20.688] [INFO] [utils] Your modules structure configuration doesn’t contain errors :)
            [2026-05-11 08:50:20.691] [LOG] [app] Loading module helpers …
            [2026-05-11 08:50:20.702] [LOG] [node_helper] Initializing new module helper …
            [2026-05-11 08:50:20.703] [LOG] [node_helper] Module helper loaded: updatenotification
            [2026-05-11 08:50:20.707] [LOG] [app] No helper found for module: clock.
            [2026-05-11 08:50:20.735] [LOG] [node_helper] Initializing new module helper …
            [2026-05-11 08:50:20.735] [LOG] [node_helper] Module helper loaded: MMM-Wallpaper
            [2026-05-11 08:50:20.737] [WARN] [app] No /home/pi/MagicMirror/modules/MMM-Remote-Control/MMM-Remote-Control.js found for module: MMM-Remote-Control.
            [2026-05-11 08:50:20.738] [LOG] [app] No helper found for module: MMM-Remote-Control.
            [2026-05-11 08:50:20.739] [LOG] [app] No helper found for module: MMM-Fireworks.
            [2026-05-11 08:50:20.742] [LOG] [node_helper] Initializing new module helper …
            [2026-05-11 08:50:20.748] [LOG] [node_helper] Module helper loaded: MMM-CalendarExt3
            [2026-05-11 08:50:21.461] [LOG] [node_helper] Initializing new module helper …
            [2026-05-11 08:50:21.462] [LOG] [node_helper] Module helper loaded: calendar
            [2026-05-11 08:50:21.469] [ERROR] [app] Error when loading MMM-TitanSchoolMealMenu: Cannot find module ‘axios’
            Require stack:

            • /home/pi/MagicMirror/modules/MMM-TitanSchoolMealMenu/TitanSchoolsClient.js
            • /home/pi/MagicMirror/modules/MMM-TitanSchoolMealMenu/node_helper.js
            • /home/pi/MagicMirror/js/app.js
            • /home/pi/MagicMirror/serveronly/index.js
              [2026-05-11 08:50:21.470] [LOG] [app] No helper found for module: MMM-UselessFacts.
              [2026-05-11 08:50:21.629] [LOG] [node_helper] Initializing new module helper …
              [2026-05-11 08:50:21.630] [LOG] [node_helper] Module helper loaded: newsfeed
              [2026-05-11 08:50:21.631] [LOG] [app] All module helpers loaded.
              [2026-05-11 08:50:21.648] [LOG] [server] Starting server on port 8080 …
              [2026-05-11 08:50:21.652] [WARN] [server] You’re using a full whitelist configuration to allow for all IPs
              [2026-05-11 08:50:21.693] [LOG] [app] Server started …
              [2026-05-11 08:50:21.695] [LOG] [node_helper] Connecting socket for: updatenotification
              [2026-05-11 08:50:21.696] [LOG] [node_helper] Starting module helper: updatenotification
              [2026-05-11 08:50:21.698] [LOG] [node_helper] Connecting socket for: MMM-Wallpaper
              [2026-05-11 08:50:21.699] [LOG] [MMM-Wallpaper] Starting node helper for: MMM-Wallpaper
              [2026-05-11 08:50:21.700] [LOG] [node_helper] Connecting socket for: MMM-CalendarExt3
              [2026-05-11 08:50:21.706] [LOG] [node_helper] Connecting socket for: calendar
              [2026-05-11 08:50:21.707] [LOG] [calendar] Starting node helper for: calendar
              [2026-05-11 08:50:21.708] [LOG] [node_helper] Connecting socket for: newsfeed
              [2026-05-11 08:50:21.710] [LOG] [newsfeed] Starting node helper for: newsfeed
              [2026-05-11 08:50:21.712] [LOG] [app] Sockets connected & modules started …
              [2026-05-11 08:50:21.714] [INFO] [serveronly]

            Ready to go! Please point your browser to: http://0.0.0.0:8080 <<<
            [2026-05-11 08:50:22.305] [INFO] [systeminformation]

            System Information

            • SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi 4 Model B Rev 1.5; virtual: false; MM: v2.36.0
            • OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch: arm64; kernel: 6.12.62+rpt-rpi-v8
            • VERSIONS: electron: undefined; used node: 22.21.1; installed node: 22.21.1; npm: 11.14.1; pm2: 6.0.14
            • ENV: XDG_SESSION_TYPE: tty; MM_CONFIG_FILE: undefined
              WAYLAND_DISPLAY: undefined; DISPLAY: undefined; ELECTRON_ENABLE_GPU: undefined
            • RAM: total: 3796.81 MB; free: 3047.70 MB; used: 749.11 MB
            • OTHERS: uptime: 44148 minutes; timeZone: America/New_York
            1 Reply Last reply Reply Quote 0
            • L Offline
              Lmagenis @sdetweil
              last edited by

              @sdetweil

              I added OpenWeatherForecast and updated TitanSchoolMealMenu then the error started. I’ve // out the openweatherforecast on the config file and still get the error. MM doesn’t load and it’s up to date.

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

                @Lmagenis the MMM-TitanSchoolMealMenu module removed the axios requirement over a year ago

                cd ~/MagicMirror/modules/MMM-TitanSchoolMealMenu
                git pull
                

                if that succeeds, do

                npm install
                

                then

                cd ~/MagicMirror
                npm run server
                

                if good, then use browser to go to

                http://localhost:8080
                

                Sam

                How to add modules

                learning how to use browser developers window for css changes

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

                  @sdetweil

                  Now it’s running perfectly if I’m using the browser.
                  So, why can’t it run if I use “npm start”?

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

                    @Lmagenis you can now… we have debugged, and it works…

                    ctrl-c to stop server and then do your normal start for MM

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

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

                      @sdetweil

                      It returned:
                      App threw an error during load
                      TypeError: styleText is not a function
                      at /home/pi/MagicMirror/js/logger.js:40:42
                      at Object. (/home/pi/MagicMirror/js/logger.js:114:2)
                      at Module._compile (node:internal/modules/cjs/loader:1141:14)
                      at Module._extensions…js (node:internal/modules/cjs/loader:1196:10)
                      at Module.load (node:internal/modules/cjs/loader:1011:32)
                      at Module._load (node:internal/modules/cjs/loader:846:12)
                      at f._load (node:electron/js2c/asar_bundle:2:13330)
                      at Module.require (node:internal/modules/cjs/loader:1035:19)
                      at require (node:internal/modules/cjs/helpers:102:18)
                      at Object. (/home/pi/MagicMirror/js/app.js:7:13)
                      A JavaScript error occurred in the main process
                      Uncaught Exception:
                      TypeError: styleText is not a function
                      at /home/pi/MagicMirror/js/logger.js:40:42
                      at Object. (/home/pi/MagicMirror/js/logger.js:114:2)
                      at Module._compile (node:internal/modules/cjs/loader:1141:14)
                      at Module._extensions…js (node:internal/modules/cjs/loader:1196:10)
                      at Module.load (node:internal/modules/cjs/loader:1011:32)
                      at Module._load (node:internal/modules/cjs/loader:846:12)
                      at f._load (node:electron/js2c/asar_bundle:2:13330)
                      at Module.require (node:internal/modules/cjs/loader:1035:19)
                      at require (node:internal/modules/cjs/helpers:102:18)
                      at Object. (/home/pi/MagicMirror/js/app.js:7:13)
                      [405959:0511/092036.982897:ERROR:wayland_connection.cc(224)] Failed to connect to Wayland display: No such file or directory (2)
                      [405959:0511/092036.983156:ERROR:ozone_platform_wayland.cc(223)] Failed to initialize Wayland platform
                      [405959:0511/092036.983172:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
                      The futex facility returned an unexpected error code.
                      /home/pi/MagicMirror/node_modules/electron/dist/electron exited with signal SIGABRT

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

                        @Lmagenis failed to connect to Wayland display

                        Npm start was changed to do Wayland, instead of x11
                        Documented in the release notes

                        Now need to do

                        npm run start:x11
                        

                        Are you using pm2 to launch?

                        How did you upgrade MagicMirror? Manually or my scripted update?

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

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

                          @sdetweil

                          I’m not using pm2.
                          I updated from the main MM site

                          When I run npm run start:x11, I’m getting the same error.

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

                            @Lmagenis ok, sounds like update didn’t complete

                            Do,

                            cd ~/MagicMirror 
                            git status
                            

                            Report output

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

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

                              @sdetweil

                              On branch master
                              Your branch is up to date with ‘origin/master’.

                              Changes not staged for commit:
                              (use “git add …” to update what will be committed)
                              (use “git restore …” to discard changes in working directory)
                              modified: package-lock.json
                              modified: package.json

                              Untracked files:
                              (use “git add …” to include in what will be committed)
                              RTSPtoWeb/
                              icons/
                              installers/
                              make_error
                              old_modules/
                              run-start.sh
                              splashscreen/

                              no changes added to commit (use “git add” and/or “git commit -a”)

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

                                @Lmagenis can you do

                                git diff package.json
                                

                                Looks like you used my installer script at some time

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

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

                                  @sdetweil

                                  Here’s what it returned:

                                  diff --git a/package.json b/package.json
                                  index b2c0eca…878e7cc 100644
                                  — a/package.json
                                  +++ b/package.json
                                  @@ -138,7 +138,7 @@
                                  “vitest”: “^4.1.5”
                                  },
                                  “optionalDependencies”: {

                                  •           "electron": "^41.3.0"
                                    
                                  •           "electron": "^22.3.4"
                                      },
                                      "engines": {
                                              "node": ">=22.21.1 <23 || >=24"
                                    
                                  S 1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sdetweil @Lmagenis
                                    last edited by sdetweil

                                    @Lmagenis hmm

                                    Do
                                    Stop MagicMirror

                                    cd ~/MagicMirror 
                                    git checkout package.json
                                    rm package-lock.json
                                    rm -rf  node_modules
                                    npm run install-mm 
                                    

                                    Start MagicMirror

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

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

                                      @sdetweil

                                      I’ve always used “npm start”. Tried starting it with both commands.

                                      pi@raspberrypi:~/MagicMirror $ Start MagicMirror
                                      -bash: Start: command not found
                                      pi@raspberrypi:~/MagicMirror $ npm start

                                      magicmirror@2.36.0 start
                                      node --run start:wayland

                                      /bin/sh: 1: ./node_modules/.bin/electron: not found
                                      pi@raspberrypi:~/MagicMirror $

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

                                        @Lmagenis fun times

                                        Try

                                        cd ~/MagicMirror 
                                        npm install electron@41.3.0
                                        

                                        please advise results

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        L 2 Replies Last reply Reply Quote 0
                                        • L Offline
                                          Lmagenis @sdetweil
                                          last edited by

                                          @sdetweil I really appreciate your help with this!

                                          The log has over 600 lines in it. Is there something specific to look for?

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

                                            @sdetweil
                                            The install returned “npm error A complete log of this…”

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

                                              @Lmagenis did it succeed or fail,

                                              Without the log

                                              Sam

                                              How to add modules

                                              learning how to use browser developers window for css changes

                                              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