Config.js issues



  • I am having some issues with the config.js file. When I turn on my pi and the Mirror client loads it tells me to create a config file. Here is the the file (with a few things removed):

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     */
    
    var config = {
    	port: 8080,
    
    	language: 'en',
    	timeFormat: 24,
    	units: 'metric',
    
    	modules: [
    		{
    			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: 'Bolton',
    				locationID: '2655237'
    			}
    		},
    		{
    			module: 'weatherforecast',
    			position: 'top_right',
    			header: 'Weather Forecast',
    			config: {
    				location: 'Bolton',
    				locationID: '2655237'```
    			}
    		},
    		{
    			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;}
    

    Please tell me if you find any errors in the code. I can’t find anything online that works.



  • @MatthewCowell

    locationID: '2655237'```
    

    remove the backticks



  • @strawberry-3.141 I have removed them but it still doesn’t work. Thank you for helping



  • @MatthewCowell does maybe the removed part you mentioned has syntax errors? you can check it yourself on jshint.com.

    is your file called config.js?


  • Module Developer

    This is also wrong:

    {
    						title: "New York Times",
    						url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml"
    					},	//
    

    Take out the // it’s negating the next bracket…

    /* Magic Mirror Config Sample
     *
     * By Michael Teeuw http://michaelteeuw.nl
     * MIT Licensed.
     */
    var config = {
            port: 8080,
    
            language: 'en',
            timeFormat: 24,
            units: 'metric',
    
            modules: [{
                        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: 'Bolton',
                            locationID: '2655237'
                        }
                    },
                    {
                        module: 'weatherforecast',
                        position: 'top_right',
                        header: 'Weather Forecast',
                        config: {
                            location: 'Bolton',
                            locationID: '2655237'
                            ``
                            `
    			}
    		},
    		{
    			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
    			}
    		}
    	]
    
    };
    


  • @cowboysdude Still not working. Thank you for the help!


  • Module Developer

    Try this: the last one I took out the // but didn’t take out the extra ‘’ strawberry suggested you take out… this one should be working.

    /* 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"],
    
    	language: 'en',
    	timeFormat: 12,
    	units: 'imperial',
    
    	modules: [
    		{
    			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: 'weatherforecast',
                        position: 'top_right',
                        header: 'Weather Forecast',
                        config: {
                            location: 'Bolton',
                            locationID: '2655237'
    			}
    		},
                    {
                        module: 'currentweather',
                        position: 'top_right',
                        config: {
                            location: 'Bolton',
                            locationID: '2655237'
                        }
                    },
                    {
    			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;}
    
    


  • @cowboysdude I still can’t get it to work. Ill try reinstalling NOOBS and magicmirror and see if it gets any better


  • Module Developer

    @MatthewCowell I ran it through a validator and it said no issues and I can’t find any …

    Why are you using Noobs? I would install this:

    https://www.raspberrypi.org/downloads/raspbian/

    When you restart copy your sample config js file to config.js and just make sure it starts…

    Once you do that do not delete your sample config file as that is your temp backup…

    Once you get it working and you add a module and it works then back up your config.js to something like config.bak that way you always have a working backup…

    in terminal window:

    cd ~MagicMirror/config
    then
    cp config.js config.bak


Log in to reply
 

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