How to check your config for errors. For absolute beginners.


  • Module Developer

    How to check your config for errors. For absolute beginners.

    This may be the shortest tutorial ever, but it may help someone at some point.
    At the very least, you can refer people here and let them read it for themselves.

    Why can’t MagicMirror check the config for me?

    Well, it can, sort of. As of version 2.1.3, there is a little known or
    documented feature that is available to everyone. Give it a try.

    My mirror says there’s an error in my config.

    • Open a terminal
    • Type cd MagicMirror and press Enter
    • Now you’re in the MagicMirror directory
    • Type npm run config:check and press Enter
    • MagicMirror will now check your config

    Example

    In this example, I removed a comma from line 29 of my config. As expected, things
    start going wrong on line 30 because of the missing comma on line 29. If this is
    not enough to help you, the information in the result will help someone else to
    help you. Altogether, a very handy little tool built right in to MagicMirror.

    daddle@daddle-Presario-CQ57-Notebook-PC:~/MagicMirror$ npm run config:check
    
    > magicmirror@2.1.3 config:check /home/daddle/MagicMirror
    > node tests/configs/check_config.js
    
    Checking file...  /home/daddle/MagicMirror/config/config.js
    Line 30 col 9 Expected '}' to match '{' from line 28 and instead saw 'distance'.
    Line 30 col 17 Expected '}' to match '{' from line 25 and instead saw ':'.
    Line 30 col 19 Expected ']' to match '[' from line 24 and instead saw 'miles'.
    Line 35 col 6 Missing semicolon.
    Line 35 col 5 Unrecoverable syntax error. (55% scanned).
    daddle@daddle-Presario-CQ57-Notebook-PC:~/MagicMirror$ 
    

    Other “Absolute Beginner” tutorials

    How to add modules. For absolute beginners.

    https://forum.magicmirror.builders/topic/4231/how-to-add-modules-for-absolute-beginners

    How to post code on the forum. For absolute beginners.

    https://forum.magicmirror.builders/topic/4247/how-to-post-code-on-the-forum-for-absolute-beginners

    Install MagicMirror on a PC Windows 7/10 - Complete walkthrough

    https://forum.magicmirror.builders/topic/4089/complete-walkthrough-install-magicmirror-on-a-pc-windows-7


  • Module Developer

    @Mykle1
    Nice job!
    It has worthy to Pin this article up or archive to FAQ.



  • I’m no developer (but I do love debbugging stuff :), so here are a list of dumb things I have needed to fix at various points

    • Check for missing commas at ends of line (I always add a comma, even if technically the code doesn’t need it)
    • Check for wrong types of Quotation marks. ie, " (double quotes) is not the same as ‘’ (two single quotes) but they look identical in some editors
    • Check for added spaces (and missing spaces)
    • Check CASE (Upper, lower, mixed) - Some modules are case sensitive, some less so.
    • Check your brackets/braces are completed

Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.