MagicMirror² v2.5.0 is available! For more information about this release, check out this topic.

Config File Undeclared 'module'



  • I’m not new to programming, but I am certainly new to scripting languages. I’m trying to get the PI to recognize even the sample config file. I’ve linted it and fixed a few syntactical errors, but the linter is stuck on the last line. I’ve included a screenshot of the error messages. Simply because I don’t know JavaScript can anyone explain these errors and how “module” is undefined?

    0_1491591046185_Lint Output 4_7_2017.PNG

    /* 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",
    
        module: [
            {
                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://www.openweathermap.org/help/city_list.txt
                    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;}
    


  • Proper image.

    0_1491591194907_Lint Output 4_7_2017.PNG


  • Moderator

    The warning can be ignored. If you check the file as a standalone, module is undefined. If this file is loaded within the framework the content is parsed and processed and module is valid