Syntax error



  • 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


  • Module Developer

    @arifms

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



  • 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;}
    


  • 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
    }
    },



  • 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.



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



  • @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



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



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

    Cheers



  • @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 ;)


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.