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.

    Unexpected Token, config not working

    Scheduled Pinned Locked Moved Troubleshooting
    4 Posts 3 Posters 1.6k 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.
    • J Offline
      jwest35
      last edited by

      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).
      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @jwest35
        last edited by

        @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

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        AlvingerA 1 Reply Last reply Reply Quote 0
        • AlvingerA Offline
          Alvinger @sdetweil
          last edited by

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

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

            @Alvinger right, after the calendarExt2 url line

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