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 error

    Scheduled Pinned Locked Moved Solved Troubleshooting
    20 Posts 5 Posters 11.1k 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.
    • A Offline
      arifms
      last edited by

      Re: MMM-PrayerTime
      How to change the language. npm start throws syntax error
      “WARNING! Could not load config file. Starting with default configuration. Error found: TypeError: Cannot read property ‘language’ of undefined”
      please guide to correct format

      Mykle1M 1 Reply Last reply Reply Quote 0
      • Mykle1M Offline
        Mykle1 Project Sponsor Module Developer @arifms
        last edited by

        @arifms

        I assume that your mirror was working until you added MMM-PrayerTime to your config.js. So, please post your config.js here.

        Create a working config
        How to add modules

        G 1 Reply Last reply Reply Quote 0
        • A Offline
          arifms
          last edited by yawns

          Yes Exactly MM was working as required until i added the MMM-PrayerTime. As reuested below is the config.js

          /* Magic Mirror Config Sample
           *
           * By Michael Teeuw http://michaelteeuw.nl
           * MIT Licensed.
           */
          
          var config = {
          	port: 8080,
          	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.
          
          	language: "en",
          	timeFormat: 24,
          	units: "metric",
          
          	modules: [
          		{
          		module: 'email',
                          position: 'bottom_left',
                          header: 'Email',
                          config: {
                              accounts: [
                                 {
                                      user: 'xxxxx@gmail.com',
                                      password: 'xxxxx',
                                      host: 'imap.gmail.com',
                                      port: 993,
                                      tls: true,
                                      authTimeout: 10000,
                                      numberOfEmails: 2,
                                  },
                              ],
                              fade: true,
                              maxCharacters: 30
                          }
          		},
          		{
          			module: 'MMM-PrayerTime',
          			position: 'top_left',
          			config: {
          				apiVersion: '1.0',
          				lat: 25.258169,
          				lon: 55.304722,
          				timezone: true,
          				method: 4,
          				playAdzan: ['fajr', 'dhuhr', 'asr', 'maghrib', 'isha'],
          				notDisplayed: ['midnight', 'sunset'],
          				useUpdateInterval: true,
          				updateInterval: 86400 * 1000,
          				animationSpeed: 2.5 * 1000,
          				language: config.language,
          				showAdzanAlert: true,
          				alertTimer: 15000
          				}
          		},
          		{
          			module: "alert",
          		},
          		{
          			module: 'MMM-ModuleScheduler'
          		},
          		{
          			module: "updatenotification",
          			position: "top_bar"
          		},
          		{
          			module: "clock",
          			position: "top_left"
          		},
          		{
          			module: "calendar",
          			header: "UAE Holidays",
          			position: "top_left",
          			config: {
          				calendars: [
          					{
          						symbol: "calendar-check-o ",
          						url: "webcal://www.calendarlabs.com/templates/ical/UAE-Holidays.ics"
          					}
          				]
          			}
          		},
          		{
          			module: "compliments",
          			position: "lower_third"
          		},
          		{
          			module: "currentweather",
          			position: "top_right",
          			config: {
          				location: "Dubai",
          				locationID: "292223",  //ID from http://www.openweathermap.org/help/city_list.txt
          				appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
          			}
          		},
          		{
          			module: "weatherforecast",
          			position: "top_right",
          			header: "Weather Forecast",
          			config: {
          				location: "Dubai",
          				locationID: "292223",  //ID from http://www.openweathermap.org/help/city_list.txt
          				appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
          			}
          		},
          		{
          			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;}
          
          1 Reply Last reply Reply Quote 0
          • cowboysdudeC Offline
            cowboysdude Module Developer
            last edited by cowboysdude

            The config isn’t working. I had to change this:

            language: config.language,

            TO:

            language: “en”,

            and this:

            timezone: true,
            to
            timezone: ‘EST’

            and it worked… so change your language and timezone that should make it work :)

            Here is an example: [the lon and lat are JUST examples, use yours].
            {
            module: ‘MMM-PrayerTime’,
            position: ‘top_left’,
            top_left/top_right.
            config: {
            apiVersion: ‘1.0’,
            lat: 12.089796,
            lon: -56.807734,
            timezone: ‘EST’,
            method: 5,
            playAdzan: [‘fajr’, ‘dhuhr’, ‘asr’, ‘maghrib’, ‘isha’],
            notDisplayed: [‘midnight’, ‘sunset’],
            useUpdateInterval: true,
            updateInterval: 86400 * 1000,
            animationSpeed: 2.5 * 1000,
            language: “en”,
            showAdzanAlert: true,
            alertTimer: 15000
            }
            },

            1 Reply Last reply Reply Quote 0
            • A Offline
              arifms
              last edited by

              Hi cowboysdude;
              Appreciate your assistance.
              I copied the example as provided, editign the lat, long & timezone to suit mine, however it still throws error.
              carefully checked the code, noted an extra line after position, removed the same.
              tried running again, with no luck.
              changed my timezone on pi to UTC from Asia/Dubai and same in to the code, still no result.
              it throws error as below;
              Starting MagicMirror: v2.1.1
              Loading config …
              WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration.
              Loading module helpers …
              Initializing new module helper …
              Module helper loaded: updatenotification
              No helper found for module: helloworld.
              All module helpers loaded.
              Starting server on port 8080 …
              Starting server op port 8080 …
              Server started …
              Connecting socket for: updatenotification
              Sockets connected & modules started …
              Launching application.

              strawberry 3.141S 1 Reply Last reply Reply Quote 0
              • cowboysdudeC Offline
                cowboysdude Module Developer
                last edited by

                Post your config file for me so I can look at it :)

                1 Reply Last reply Reply Quote 0
                • strawberry 3.141S Offline
                  strawberry 3.141 Project Sponsor Module Developer @arifms
                  last edited by

                  @arifms if you copied the config from @cowboysdude you are using the wrong quotes replace all quotes with either ' or ", because backticks don’t work

                  Please create a github issue if you need help, so I can keep track

                  1 Reply Last reply Reply Quote 0
                  • cowboysdudeC Offline
                    cowboysdude Module Developer
                    last edited by

                    I just linted his config and sent it to him pm…

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      arifms
                      last edited by

                      @ strawberry
                      Thanks for pointing out the error.
                      all working good now.
                      @cowboysdude edited the app id’s thanks again for pointing it out.

                      Cheers

                      cowboysdudeC 1 Reply Last reply Reply Quote 1
                      • cowboysdudeC Offline
                        cowboysdude Module Developer @arifms
                        last edited by

                        @arifms said in Syntax error:

                        @ strawberry
                        Thanks for pointing out the error.
                        all working good now.
                        @cowboysdude edited the app id’s thanks again for pointing it out.

                        Cheers

                        Yeah my fault… it doesn’t copy to the forum… it changes the quotes… sorry about that. Been up since 4 not enough tea yet ;)

                        1 Reply Last reply Reply Quote 0
                        • G Offline
                          Gxnfr Ali @Mykle1
                          last edited by

                          @Mykle1
                          that is my confis.js file…but prayer module does not work…

                          /* Magic Mirror Config Sample
                          *

                          • By Michael Teeuw http://michaelteeuw.nl
                          • MIT Licensed.
                            */

                          var config = {
                          port: 8080,
                          ipWhitelist: [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”], // Set [] to allow all IP addresses.

                          language: "en",
                          timeFormat: 24,
                          units: "metric",
                          
                          modules: [
                          	{
                          		module: "alert",
                          	},
                          	
                          	{
                          		module: "updatenotification",
                          		position: "top_bar"
                          	},
                          	{
                          	module: 'email',
                                      position: 'bottom_left',
                                      header: 'Email',
                                      config: {
                                          accounts: [
                                             {
                                                  user: 'xxxxx@gmail.com',
                                                  password: 'xxxxx',
                                                  host: 'imap.gmail.com',
                                                  port: 993,
                                                  tls: true,
                                                  authTimeout: 10000,
                                                  numberOfEmails: 2,
                                              },
                                          ],
                                          fade: true,
                                          maxCharacters: 30
                                      }
                          	},
                          	{
                          		module: "clock",
                          		position: "top_left"
                          	},
                          	{
                          		module: "calendar",
                          		header: "PK Holidays",
                          		position: "top_left",
                          		config: {
                          			calendars: [
                          				{
                          					symbol: "calendar-check-o ",
                          					url: "webcal://www.officeholidays.com/ics/ics_country_code.php?iso=PK"
                          				}
                          			]
                          		}
                          	},
                          	{
                          		module: "compliments",
                          		position: "lower_third"
                          	},
                          	{
                          		module: "currentweather",
                          		position: "top_right",
                          		config: {
                          			location: "Dubai",
                          			locationID: "1166547",  //ID from http://www.openweathermap.org/help/city_list.txt
                          			appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
                          		}
                          	},
                          	{
                          		module: "weatherforecast",
                          		position: "top_right",
                          		header: "Weather Forecast",
                          		config: {
                          			location: "Dubai",
                          			locationID: "1166547",  //ID from http://www.openweathermap.org/help/city_list.txt
                          			appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                          		}
                          	},
                          	{
                          		module: 'MMM-PrayerTime',
                          		position: 'top_left',
                          		config: {
                          			apiVersion: '1.0',
                          			lat: '30.6612',
                          			lon: '73.1086',
                          			timezone: 'Asia/Karachi',
                          			method: 4,
                          			playAdzan: ['fajr', 'dhuhr', 'asr', 'maghrib', 'isha'],
                          			notDisplayed: ['midnight', 'sunset'],
                          			useUpdateInterval: true,
                          			updateInterval: 86400 * 1000,
                          			animationSpeed: 2.5 * 1000,
                          			language: config.language,
                          			showAdzanAlert: true,
                          			alertTimer: 15000
                          			}
                          	},
                          	{
                          		module: "newsfeed",
                          		position: "bottom_bar",
                          		config: {
                          			feeds: [
                          				{
                          					title: "New York Times",
                          					url: "https://news.google.com/news/rss/local?ned=en_pk&hl=en&gl=US"
                          				}
                          			],
                          			showSourceTitle: true,
                          			showPublishDate: true
                          		}
                          	},
                          ]
                          

                          };

                          /*************** DO NOT EDIT THE LINE BELOW ***************/
                          if (typeof module !== “undefined”) {module.exports = config;}

                          1 Reply Last reply Reply Quote 0
                          • cowboysdudeC Offline
                            cowboysdude Module Developer
                            last edited by

                            @Gxnfr-Ali said in Syntax error:
                            there’s a problem in this line…take it out and what’s below is valid according to this site:
                            http://esprima.org/demo/validate.html

                            as for the prayer module not working you should post in that topic and get help with that as I’m not sure why it’s not working.

                            ipWhitelist: [“127.0.0.1”, “::ffff:127.0.0.1”, “::1”],

                            var config = {
                            	port: 8080,
                            	 
                            	language: "en",
                            	timeFormat: 24,
                            	units: "metric",
                            
                            	modules: [{
                            			module: "alert",
                            		},
                            
                            		{
                            			module: "updatenotification",
                            			position: "top_bar"
                            		},
                            		{
                            			module: 'email',
                            			position: 'bottom_left',
                            			header: 'Email',
                            			config: {
                            				accounts: [{
                            					user: 'xxxxx@gmail.com',
                            					password: 'xxxxx',
                            					host: 'imap.gmail.com',
                            					port: 993,
                            					tls: true,
                            					authTimeout: 10000,
                            					numberOfEmails: 2,
                            				}, ],
                            				fade: true,
                            				maxCharacters: 30
                            			}
                            		},
                            		{
                            			module: "clock",
                            			position: "top_left"
                            		},
                            		{
                            			module: "calendar",
                            			header: "PK Holidays",
                            			position: "top_left",
                            			config: {
                            				calendars: [{
                            					symbol: "calendar-check-o ",
                            					url: "webcal://www.officeholidays.com/ics/ics_country_code.php?iso=PK"
                            				}]
                            			}
                            		},
                            		{
                            			module: "compliments",
                            			position: "lower_third"
                            		},
                            		{
                            			module: "currentweather",
                            			position: "top_right",
                            			config: {
                            				location: "Dubai",
                            				locationID: "1166547", 
                            				appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
                            			}
                            		},
                            		{
                            			module: "weatherforecast",
                            			position: "top_right",
                            			header: "Weather Forecast",
                            			config: {
                            				location: "Dubai",
                            				locationID: "1166547", 
                            				appid: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                            			}
                            		},
                            		{
                            			module: 'MMM-PrayerTime',
                            			position: 'top_left',
                            			config: {
                            				apiVersion: '1.0',
                            				lat: '30.6612',
                            				lon: '73.1086',
                            				timezone: 'Asia/Karachi',
                            				method: 4,
                            				playAdzan: ['fajr', 'dhuhr', 'asr', 'maghrib', 'isha'],
                            				notDisplayed: ['midnight', 'sunset'],
                            				useUpdateInterval: true,
                            				updateInterval: 86400 * 1000,
                            				animationSpeed: 2.5 * 1000,
                            				language: config.language,
                            				showAdzanAlert: true,
                            				alertTimer: 15000
                            			}
                            		},
                            		{
                            			module: "newsfeed",
                            			position: "bottom_bar",
                            			config: {
                            				feeds: [{
                            					title: "New York Times",
                            					url: "https://news.google.com/news/rss/local?ned=en_pk&hl=en&gl=US"
                            				}],
                            				showSourceTitle: true,
                            				showPublishDate: true
                            			}
                            		},
                            	]
                            };
                            
                            G 1 Reply Last reply Reply Quote 0
                            • G Offline
                              Gxnfr Ali @cowboysdude
                              last edited by

                              @cowboysdude
                              hi
                              can u help me?

                              cowboysdudeC 1 Reply Last reply Reply Quote 0
                              • cowboysdudeC Offline
                                cowboysdude Module Developer @Gxnfr Ali
                                last edited by

                                @Gxnfr-Ali I just did …the config I posted is valid and should work :)

                                The prayer module you will have to get help in that topic for it… I don’t know that module :)

                                What exactly do you need help with? :)

                                G 2 Replies Last reply Reply Quote 0
                                • G Offline
                                  Gxnfr Ali @cowboysdude
                                  last edited by

                                  @cowboysdude okay and thanks

                                  1 Reply Last reply Reply Quote 1
                                  • G Offline
                                    Gxnfr Ali @cowboysdude
                                    last edited by

                                    @cowboysdude
                                    what module you can magicmirror done?

                                    cowboysdudeC 1 Reply Last reply Reply Quote 0
                                    • cowboysdudeC Offline
                                      cowboysdude Module Developer @Gxnfr Ali
                                      last edited by

                                      @Gxnfr-Ali I’m not sure what you mean

                                      G 3 Replies Last reply Reply Quote 0
                                      • G Offline
                                        Gxnfr Ali @cowboysdude
                                        last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • G Offline
                                          Gxnfr Ali @cowboysdude
                                          last edited by

                                          @cowboysdude sir

                                          1 Reply Last reply Reply Quote 0
                                          • G Offline
                                            Gxnfr Ali @cowboysdude
                                            last edited by

                                            @cowboysdude can you help me in MMM-NOAA and MMM-awesome-alexa

                                            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