• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

syntax errors

Scheduled Pinned Locked Moved Unsolved Troubleshooting
11 Posts 5 Posters 2.9k Views 5 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.
  • E Offline
    Egnos @ganget
    last edited by Jan 7, 2019, 4:28 PM

    Sorry @ganget, but I’m not sure that the configuration you propose can work, because after opening a “{” is closed with a “},” and the “},” is used only for the closure of the entire module and not the single configurations. Correct?

    Is it possible that the problem is on the comma after “mpg321”?

    play: { // Full values are in `FOR EXPERTS` section.
          playProgram: "mpg321", // recommended.
    

    Thank you all!

    My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

    1 Reply Last reply Reply Quote 0
    • S Away
      sdetweil
      last edited by sdetweil Jan 7, 2019, 4:48 PM Jan 7, 2019, 4:47 PM

      from the MM folder run

      node tests/configs/check_config.js

      find and fix all errors, starting from the top of the list

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      E 1 Reply Last reply Jan 7, 2019, 6:31 PM Reply Quote 0
      • Y Offline
        yawns Moderator
        last edited by Jan 7, 2019, 5:10 PM

        @ganget is right, your { } are mixed up.

        This passes the test on jshint.com

        /* Magic Mirror Config Sample
         *
         * By Michael Teeuw http://michaelteeuw.nl
         * MIT Licensed.
         *
         * For more information how you can configurate 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, is "localhost"
        	port: 8080,
        	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"],
        
        	language: "en",
        	timeFormat: 24,
        	units: "metric",
        
        	modules: [
        		{
        		  module: "MMM-AssistantMk2",
        		  position: "top_right",
        		  config: {
        		    deviceLocation: {
        					coordinates: { // set the latitude and longitude of the device to get localized information like weather or time. (ref. mygeoposition.com)
        					latitude: 45.200049, // -90.0 - +90.0
        					longitude: 7.568917, // -180.0 - +180.0					
                  },
                },
        			profiles: {
        				"default" : { // profile name.
        				profileFile: "default.json", // profile file name.
        				lang: "it-IT",
        				//currently available (estimation, not all tested):
        				//  de-DE, en-AU, en-CA, en-GB, en-US, en-IN
        				// fr-CA, fr-FR, it-IT, ja-JP, es-ES, es-MX, ko-KR, pt-BR
        				// https://developers.google.com/assistant/sdk/reference/rpc/languages
        				}
                },
        			record: { // Full values are in `FOR EXPERTS` section.
        				recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
        				device: null        // recording device (e.g.: "plughw:1")
              },
        			play: { // Full values are in `FOR EXPERTS` section.
        				playProgram: "mpg321", // recommended.
        			}        
              }
                },
        		{
        			module: "alert",
        		},
        		{
        			module: "updatenotification",
        			position: "top_bar"
        		},
        		{
        			module: "clock",
        			position: "top_left"
        		},
        		{
        			module: "calendar",
        			header: "US Holidays",
        			position: "top_left",
        			config: {
        				calendars: [
        					{
        						symbol: "calendar-check-o ",
        						url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
        					}
        				]
        			}
        		},
        		{
        			module: "compliments",
        			position: "lower_third"
        		},
        		{
        			module: "currentweather",
        			position: "top_right",
        			config: {
        				location: "New York",
        				locationID: "",  //ID from http://bulk.openweathermap.org/sample/; unzip the gz file and find your city
        				appid: "YOUR_OPENWEATHER_API_KEY"
        			}
        		},
        		{
        			module: "weatherforecast",
        			position: "top_right",
        			header: "Weather Forecast",
        			config: {
        				location: "New York",
        				locationID: "5128581",  //ID from http://www.openweathermap.org/help/city_list.txt
        				appid: "YOUR_OPENWEATHER_API_KEY"
        			}
        		},
        		{
        			module: "newsfeed",
        			position: "bottom_bar",
        			config: {
        				feeds: [
        					{
        						title: "New York Times",
        						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
        					}
        				],
        				showSourceTitle: true,
        				showPublishDate: true
        			}
        		},
        	]
        
        };
        
        /*************** DO NOT EDIT THE LINE BELOW ***************/
        if (typeof module !== "undefined") {module.exports = config;}
        

        Also, if you look at the readme for this module configuration you notice the { } need to be set different.

        1 Reply Last reply Reply Quote 0
        • E Offline
          Egnos @sdetweil
          last edited by Egnos Jan 7, 2019, 6:41 PM Jan 7, 2019, 6:31 PM

          @sdetweil said in syntax errors:

          from the MM folder run

          node tests/configs/check_config.js

          find and fix all errors, starting from the top of the list

          Thanks, as soon possible I will try this command.

          Ok thanks @ganget, but I do not understand why if I remove the comma of the “}” referring to “play” the configuration does not give problems but if I remove the comma from the “}” referring to “record” it goes into error…

          	record: { // Full values are in `FOR EXPERTS` section.
          			recordProgram: "arecord",  // Defaults to "arecord" - also supports "rec" and "sox"
          			device: null        // recording device (e.g.: "plughw:1")
            },
          		play: { // Full values are in `FOR EXPERTS` section.
          			playProgram: "mpg321", // recommended.
          		}        
          

          Sorry for the banalities … but I’m a beginner.:smiling_face_with_open_mouth_cold_sweat:

          My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

          S G 2 Replies Last reply Jan 7, 2019, 6:40 PM Reply Quote 0
          • S Away
            sdetweil @Egnos
            last edited by sdetweil Jan 7, 2019, 6:41 PM Jan 7, 2019, 6:40 PM

            @egnos comma is continuation… its ok to have an EXTRA , after the play group,… it is NOT ok to have a missing , between things

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 3
            • G Offline
              ganget @Egnos
              last edited by Jan 8, 2019, 9:54 AM

              @egnos As @sdetweil already stated the comma’s are for showing the code that there is more to run after the line. It is no problem to have a extra comma at the end. But if you don’t put a comma the code doesn’t run further and gives you a syntax error. The {} are for making a object in JS, if you don’t close the object with a } you will also get a syntax error.

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 1 / 2
              1 / 2
              • First post
                10/11
                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