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


  • Being new to MM, JS, Node, etc myself, it would have been of great help to have some functional and pictorial description of the parts making up a MM Module. Basically an idiots-guide-to-making-your-own-module (and understanding what you are doing). I’d buy it!



  • @E3V3A said in How to check your config for errors. For absolute beginners.:

    Being new to MM, JS, Node, etc myself, it would have been of great help to have some functional and pictorial description of the parts making up a MM Module. Basically an idiots-guide-to-making-your-own-module (and understanding what you are doing). I’d buy it!

    Dude until I started with MM I didn’t even know JS but Thanks to a great guy [he knows who he is] that I won’t mention because I don’t want to point people at him and have him overwhelmed with questions…he’s a busy kid 🙂 At any rate I didn’t even know JS but if you want to build a module then look inside one and form your questions and ask them. Many people would be happy to help and explain it to help you out!





  • @strawberry-3.141 Yeah, Thanks. I saw that before, and have already added/corrected some Wiki info in the dev repo. (When is that dev gonna get merged to master, anyway?) Also looked at the Template… very useful.



  • @E3V3A the next release should be on 1st of april