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.

    No JavaScript experience - Config.js not working

    Scheduled Pinned Locked Moved Bug Hunt
    16 Posts 3 Posters 5.6k 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.
    • ? Offline
      A Former User
      last edited by

      This post is deleted!
      O 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @OlesonCrypto
        last edited by

        @olesoncrypto in the MagicMirror folder do

        npm run config:check
        

        the output will report a line number of an error

        unexpected token line 45

        well, look at line 44, and see if it should have a trailing comma (meaning more to follow)

        repeat til no error

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        O 2 Replies Last reply Reply Quote 1
        • O Offline
          OlesonCrypto @Guest
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • O Offline
            OlesonCrypto @sdetweil
            last edited by

            @sdetweil So you’re saying delete the commas above the line where it shows I have an unexpected token line?

            O S 2 Replies Last reply Reply Quote 0
            • O Offline
              OlesonCrypto @OlesonCrypto
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @OlesonCrypto
                last edited by

                @olesoncrypto no. add. but I see u fixed it

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 1
                • O Offline
                  OlesonCrypto @sdetweil
                  last edited by

                  @sdetweil Hey I just fixed it all up thanks you to! Adding commas a line above the syntax error fixed it. I was so happy to see “Your configuration file doesn’t contain syntax errors :)” lmao. You’re a life safer

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

                    @olesoncrypto see my MMM-Config module. it presents a form to fill in for config.js. no more commas!!

                    https://github.com/sdetweil/MMM-Config

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

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

                      @sdetweil I have a new issue. Instead of seeing the original Magic Mirror^2 screen that says “add a config.js file or fix the syntax errors” now only shows a black screen. Both my mmstart.sh and magicmirror is active with my pm2. I also have downloaded chromium-browser. Do you know what might be the cause of this? I’ve downloaded all the module content inside of each module directory with npm.

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

                        @olesoncrypto this is typically caused by a missing library.

                        we removed some, and it turns out modules didn’t document using them

                        look at the pm2 log

                        command

                        pm2 logs --lines=100
                        

                        looking for module not found.

                        for each of those, go to the module folder
                        if there is NOT a package.json file do

                        npm init -y
                        

                        then in either case do

                        npm install xxx -- save
                        

                        where xx is the name of the not found thing

                        we know about
                        request
                        rrule-alt
                        and
                        valid-url

                        then restart mm

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

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

                          @sdetweil

                          0|mmstart  | /home/pi/MagicMirror/js/app.js:20
                          0|mmstart  | Log.log("Starting MagicMirror: v" + global.version);
                          0|mmstart  |     ^
                          0|mmstart  | TypeError: Log.log is not a function
                          

                          I’m not sure how to fix this one. I nano’d into the file and they show a bunch of these log.log within the app.js file

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

                            @olesoncrypto yeh, its provided by the logger

                            so,

                            give me output of
                            node -v
                            and npm -v

                            if u rename your config.js to save.config.js (mv is the rename command in lnux)
                            and copy the sample.config.js to config.js (in the config folder)

                            does it work ?

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

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

                              @sdetweil I was able to finally make it work! I just completed deleted the MagicMirror with sudo rm -r ~/MagicMirror and then reinstalled it. I copied the config.js.sample to my real config.js file. I ran that and it finally worked! I was fixing it up and then it happened again as I was imputing parts of my old code. I realized that my issue was that I had the useHTTPs: "false", instead of useHTTPs: false, which was the real reason there was just a blank screen. I appreciate your time and effort to help me out, especially with the fast responses. You’re a true life saver @sdetweil :)

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

                                @olesoncrypto awesome, glad u got it working

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

                                  @olesoncrypto yes, that will get you

                                  general rules for config.js

                                  
                                  the thing to the left of :  does not need quotes
                                  for the thing to the right of : 
                                        if it is a number (9, -1.234) or true/false  , no quotes
                                        if it contains a letter 12ff234, bob,   then needs quotes, 
                                           
                                  single or double doesn't matter  as long as they are the same start and end
                                  
                                  every { needs a  matching }
                                  every [ needs a  matching ]
                                  
                                  [] is a list [ 1,2,3,4] or [ first,second,third]
                                  {} is a structure/object with name/value pairs  
                                      {    x: value, y: othervalue }
                                  
                                  u can write lists and objects all on one line (what a pain)
                                  or across multiple lines... (much more readable)
                                      BUT, you STILL need the commas between items in either 
                                  
                                  if u get an error, unexpected token, 99% of the time, 
                                  u forgot a trailing comma on the line ABOVE the one reported (error on line 45, look at line 44)
                                  
                                  a good debug process is to join the list or object to a single line in your editor,
                                   and get the , between the items, then split it again after each comma...  
                                  so u have a separate item on each line. 
                                  
                                  

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  1 Reply Last reply Reply Quote 1

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