MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Unexpected Token, config not working



  • I am new to all this and been trying to get the look and feel that I want. I found some code online to help me with it, however I keep getting a syntax error, unexpected token

     *
     * By Michael Teeuw https://michaelteeuw.nl
     * MIT Licensed.
     *
     * For more information on how you can configure this file
     * See https://github.com/MichMich/MagicMirror#configuration
     *
     */
    
    var config = {
    address: "localhost", // Address to listen on, can be:
    // - "localhost", "127.0.0.1", "::1" to listen on loopback interface
    // - another specific IPv4/6 to listen on a specific interface
    // - "0.0.0.0", "::" to listen on any interface
    // Default, when address config is left out or empty, is "localhost"
    port: 8080,
    basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy
    // you must set the sub path here. basePath must end with a /
    ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
    // or add a specific IPv4 of 192.168.1.5 :
    // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
    // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
    // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
    
    useHttps: false, // Support HTTPS or not, default "false" will use HTTP
    httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true
    httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true
    
    language: "en",
    logLevel: ["INFO", "LOG", "WARN", "ERROR"],
    timeFormat: 24,
    units: "imperial",
    // serverOnly:  true/false/"local" ,
    // local for armv6l processors, default
    //   starts serveronly and then starts chrome browser
    // false, default for all NON-armv6l devices
    // true, force serveronly mode, because you want to.. no UI on this device
    
    modules: [
    {
    module: "alert",
    },
    {
    module: "updatenotification",
    position: "top_bar"
    },
    {
    module: "clock",
    position: "top_left"
    },
    {
    module: "currentweather",
    position: "top_right",
    config: {
    location: "Conway",
    locationID: "4106458", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
    appid: "dfa44a36596bdb042674a5e3058849c7"
    }
    },
    {
    module: "weatherforecast",
    position: "top_right",
    header: "Weather Forecast",
    config: {
    location: "Conway",
    locationID: "4106458", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
    appid: "dfa44a36596bdb042674a5e3058849c7"
    }
    },
    {
    module: "calendar",
    header: "US Holidays",
    position: "top_left",
    config: {
     calendars: [
    symbol: "calendar-check",
    url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics" }
    ]
    }
    },
                    {
                            module: "MMM-CalendarExt2",
                            config: {
                              calendars: [
                                {
                                        url: "https://mycalendar"
                            ],    
                            },
                             
                                views: [
                                    {
                                      title: "Upcoming Events",
                                      name: "DailyView",
                                      mode: "daily",
                                      calendars: [],
                                      position:"top_left",
                                      hideOverflow: false,
                                      slotCount: 3,
                                      className: "remove_empty_slot"
                                    },
    
                                  {
                                    mode: "month",
                                    position: "fullscreen_below",
                                    timeFormat: "h:mm",
                                    hideOverflow: false,
                                    slotMaxHeight: "200px",
                                    maxItems: 500,
                                  },
                                ],
                                scenes: [
                                  {
                                    name: "DEFAULT",
                                  },
                                ],
                              },
                            },]
    };
    
    
    ******************CSS*****************
    
    body {
            margin: 10px;
    /*      height: calc(100%);*/
            width: 1060px;
    }
    
    .CX2 .remove_empty_slot .eventCount_0 {
      display:none;
    }
    
    .CX2 .cellSlot .slotSubTitle {
    color:#3A6061;
    }
    
    .CX2 .cellSlot .slotTitle {
    color:#999;
    text-alignment: "right";
    }
    
    .CX2 .cellSlot.weekday_6 .slotSubTitle {
    color:#3A6061;
    }
    
    .CX2 .cellSlot.weekday_6 .slotTitle {
    color:#999;
    }
    
    .CX2 .cellSlot.weekday_7 .slotSubTitle {
    color:#661414;
    }
    
    .CX2 .slot{
    padding:0px 4px;
    border:4px solid #000000;
    }
    
    /* Formats header */
    .CX2 .slot .slotHeader {
    background-color:#000000;
    border-top:2px solid #3A6061;
    border-bottom:2px solid #3A6061;
    margin-top:5px;
    margin-bottom:15px;
    height:calc(var(--font-size) + 6px);
    font-weight:normal;
    padding:6px 6px 0;
    }
    
    .CX2 .today .slotHeader { /* today slot /
    background-color:#afcecf;
    /* background-color:#080a0a;*/
    color:#999;
    }
    
    .CX2 .today .slotHeader * {
    color:#999;
    }
    
    .CX2 .today .slotSubTitle {
    color:#3A6061;
    }
    
    .CX2 .weekSlot {
    position:relative;
    }
    
    .CX2 .today.slot {
    /*background-color:#afcecf;*/
    background-color:#0a1010;
    border:4px solid #1d2f30;
    }
    
    .CX2 .slot > .slotContent{
    position:relative;
    width:100%;
    background-image: none;
    }
    
    .CX2 .module-content { /* fake module body */
    color:#999;
    font-family: 'Roboto', sans-serif;
    }
    
    .CX2 .weeksmark {
    display:none;
    }
    
    /***** Event *****/
    .CX2 .event {
    padding:5px;
    margin:12px 0 0 8px;
    background-color:transparent;
    position:relative;
    text-align:left;
    }
    
    /* how to treat full day events*/
    .CX2 .event.fullday {
    border-radius:unset;
    background-color:transparent;
    color:#999;
    margin:12px 0 0 8px;
    }
    
    /*************** DO NOT EDIT THE LINE BELOW ***************/
    if (typeof module !== "undefined") {module.exports = config;}```
    
    Any help is greatly appreciated. Says its on 77, and have tried everything. This is from JShint (I know its going to be something stupid.
    93	Expected ']' to match '[' from line 92 and instead saw ':'.
    93	Expected '}' to match '{' from line 91 and instead saw 'calendar-check'.
    96	Unrecoverable syntax error. (39% scanned).


  • @jwest35 unexpected token means the line before the error does not have a trailing comma.

    general rules

    the thing to the left of : does not need to be quoted
    to the right of the colon does not need quotes it it is a number, or is true or false.
    otherwise it needs quotes. either kind will work, as long as the start and end are the same.

    if the next line starts with a word, then this line needs to end with a comma



  • @jwest35, you’re missing a left curly brace.



  • @Alvinger right, after the calendarExt2 url line


Log in to reply