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 Unsolved Troubleshooting
    24 Posts 2 Posters 71 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 @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
                                  • S Offline
                                    sdetweil @Lmagenis
                                    last edited by

                                    @Lmagenis can you send me the log , same userid at gmail please

                                    Sam

                                    How to add modules

                                    learning how to use browser developers window for css changes

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

                                      The log says your disk/sd card is full (or failing)

                                      no space left on device
                                      

                                      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 Thank you! Looks like I have some cloning to do (once I get the new card)

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

                                          @Lmagenis yes, maybe there is a bunch of log files you can delete

                                          Then you could use my backup/restore scripts
                                          https://github.com/sdetweil/MagicMirror-backup-restore.git

                                          Which has a perfect use for this
                                          Very small data. Can use GitHub too as the storage place

                                          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