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] _ is not defined

    Scheduled Pinned Locked Moved Solved Troubleshooting
    36 Posts 3 Posters 12.7k Views 3 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
      sdetweil @nowayto
      last edited by

      @nowayto weird, and npm start fails again _ not defined?

      i installed solarpicture without problems

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      N 1 Reply Last reply
      Reply Quote 0
      • N
        nowayto @sdetweil
        last edited by

        @sdetweil
        I’m sure.I don’t think SolarPicture could be the problem.

        Yes, the error keep showing

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

          @nowayto wild, lets do this… intall MM again, but save the current…

          #backup MM config and modules list
          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_backup.sh)"
          #rename the MagicMirror folder out of the way
          cd ~
          mv MagicMirror MagicMirror.save
          #and install MM again
          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror_scripts/master/raspberry.sh)"
          #restore the  MM config and modules
          bash -c  "$(curl -sL https://raw.githubusercontent.com/sdetweil/MagicMirror-backup-restore/main/mm_restore.sh)" 
          

          then

          cd ~/MagicMirror
          npm start 
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          N 2 Replies Last reply
          Reply Quote 0
          • N
            nowayto @sdetweil
            last edited by

            @sdetweil
            Before writing here I made backups, locally and on github, like you taught me in the past :)

            Now I’ll try

            1 Reply Last reply
            Reply Quote 1
            • N
              nowayto @sdetweil
              last edited by nowayto

              @sdetweil

              That’s incredible… I did it, everything goes good… no issues but when I start it

              npm start

              magicmirror@2.31.0 start
              npm run start:x11

              magicmirror@2.31.0 start:x11
              DISPLAY=“${DISPLAY:=:0}” ./node_modules/.bin/electron js/electron.js

              [2025-05-11 22:44:21.593] [LOG] Starting MagicMirror: v2.31.0
              [2025-05-11 22:44:21.682] [LOG] Loading config …
              [2025-05-11 22:44:21.687] [LOG] config template file not exists, no envsubst
              [2025-05-11 22:44:23.250] [INFO] Checking config file /home/MYMIRR/MagicMirror/config/config.js …
              [2025-05-11 22:44:23.532] [INFO] Your configuration file doesn’t contain syntax errors :)
              [2025-05-11 22:44:23.535] [INFO] Checking modules structure configuration …
              [2025-05-11 22:44:23.824] [ERROR] _ is not defined

              Again this _ is not defined

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

                @nowayto wow!!! NOW i am really confused.

                have you rebooted?

                if you try the sample config.js

                cd ~/MagicMirror/config
                mv config.js config.js.save
                cp config.js.sample config.js
                

                and then
                npm start

                does it run or fail

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                N 1 Reply Last reply
                Reply Quote 0
                • N
                  nowayto @sdetweil
                  last edited by

                  @sdetweil
                  Sam… I don’t know how to saying it.
                  I figure out the issue.

                  After your last message I tried what you suggest.
                  With the default cfg I had no errors, with mine I had errors.

                  So I checked again and again the config…
                  and I find an underscore _ right at the start of the config

                  npm config:check told me “no syntax errors” and that confusing me.

                  When I edit it I use nano editor
                  I do “sudo nano config.js” and I press CTRL + _ to jump at the 250 line.
                  Might be one of the latest time I opened it and press _ a bit faster than CTRL and I add it for error.

                  In addition I notice that when I open config.js with nano editor the green cursor is, clearly, at the start of the first line… EXACTLY on the undescore _ and it hides it.

                  I’m really sorry for bothering you with that.
                  How can I buy you a coffee ?
                  Thanks

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

                    @nowayto no coffee needed, we found it!!!

                    please NEVER use sudo inside MagicMirror folder
                    no reason to use super user , just makes trouble later

                    so if you fix the config.js in the saved MagicMirror folder then it should run ok too!!!"

                    ill see what we can do about the misleading message… thanks for your energy here!!!

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S N 3 Replies Last reply
                    Reply Quote 0
                    • S
                      sdetweil @sdetweil
                      last edited by

                      @nowayto i use ctrl-end on my keyboard for nano to get to end of file

                      haven’t found a way to do that on my chromebook, drives me crazy!!!

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

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

                        @nowayto ok, I’ve found the error producer
                        and I’ll propose a fix…

                        I think this might have been more useful lol

                        [ERROR] fatal error in /home/sam/MagicMirror/config/config.js at line 19 column 1,  _ is not defined
                        

                        I opened
                        https://github.com/MagicMirrorOrg/MagicMirror/issues/3785

                        for this issue

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply
                        Reply Quote 1
                        • N
                          nowayto @sdetweil
                          last edited by

                          @sdetweil Ok but I wanna just offer a coffe for your kind and your time spent with that.

                          Do you suggest me to fix the old magic mirror folder or just rm it?

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

                            @nowayto if you have everything working, you can rm it

                            i was just saying you could prove this change would fix the prior install

                            i do this for fun, really! pay it forward, help someone else on whatever when you can.

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            R 1 Reply Last reply
                            Reply Quote 1
                            • R
                              rkorell Module Developer @sdetweil
                              last edited by

                              @sdetweil

                              i do this for fun, really!

                              awesome!
                              highly appreciated!

                              Ralf

                              S N 2 Replies Last reply
                              Reply Quote 0
                              • S
                                sdetweil @rkorell
                                last edited by

                                @rkorell I meet the most amazing people, with the most amazing ideas… and I get to help them?!

                                what more can you ask for?!

                                Sam

                                How to add modules

                                learning how to use browser developers window for css changes

                                1 Reply Last reply
                                Reply Quote 1
                                • S sdetweil has marked this topic as solved on
                                • N
                                  nowayto @rkorell
                                  last edited by

                                  @rkorell Again, thank you Sam.
                                  I know what you mean, I usually act as you said.
                                  I like to help other, in the subject where I have knowledge.
                                  So, thank you again

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

                                    @nowayto there is a better fix, coming in the next release…

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