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

Unrecognized Config file

Scheduled Pinned Locked Moved Troubleshooting
14 Posts 5 Posters 7.5k Views 3 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.
  • D Offline
    dejayou
    last edited by MichMich Jul 31, 2016, 3:21 PM Jul 31, 2016, 2:44 PM

    Hi everyone, new coder here, but despite searching this forum for a solution and essentially duplicating the exact source code, I still can’t manage to have the raspberry pi recognize my Magic Mirror config file. I’ve renamed the file, dropping the “sample”, and saved and rebooted everything, but still no luck. After attempting to load the program, I am met with the same error screen others have mentioned that asks me to create a config file. I understand that since the config file exists, there must be some sort of error within the code, but after running it through both JSLint and JSHint, I haven’t found anything to be coming back as an error. Any ideas?

    The entire source code can be found below:

    /* 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: ‘wuforecast’,
            position: ‘top_right’, // This can be any of the regions.
            // Best results in left or right regions.
            config: {
                // See ‘Configuration options’ for more information.
                location: ‘France / Paris’,
                appid: ‘abcde12345abcde12345abcde12345ab’ //wunderground.com API key.
            }
        }, {
            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 bulk.openweather.org/sample/
                appid: 'YOUR_OPENWEATHER_API_KEY'
            }
        }, {
            module: 'weatherforecast',
            position: 'top_right',
            header: 'Weather Forecast',
            config: {
                location: 'New York',
                locationID: '5128581', //ID from bulk.openweather.org/sample/
                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;
    }
    

    ADMIN NOTE: Please use markup for codeblock.

    1 Reply Last reply Reply Quote 0
    • M Offline
      MichMich Admin
      last edited by Jul 31, 2016, 3:22 PM

      Copy paste your code into http://jshint.com and you’ll see why …

      D 1 Reply Last reply Jul 31, 2016, 5:10 PM Reply Quote 0
      • D Offline
        dejayou @MichMich
        last edited by Jul 31, 2016, 5:10 PM

        @MichMich
        Thank you for your swift response. I did copy and paste into JSHint and the only error note I received was specific to line 74 and “one undefined variable” the ‘module’ variable.

        This however is below the note exclaiming “do not edit the line below”. Should this actually read something different?

        /* 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: “wuforecast”,
          position: “top_right”, // This can be any of the regions.
          // Best results in left or right regions.
          config: {
          // See ‘Configuration options’ for more information.
          location: “France / Paris”,
          appid: “abcde12345abcde12345abcde12345ab” //wunderground.com API key.
          }
          }, {
          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 bulk.openweather.org/sample/
          appid: ‘YOUR_OPENWEATHER_API_KEY’
          }
          }, {
          module: ‘weatherforecast’,
          position: ‘top_right’,
          header: ‘Weather Forecast’,
          config: {
          location: ‘New York’,
          locationID: ‘5128581’, //ID from bulk.openweather.org/sample/
          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;
        }

        S 1 Reply Last reply Jul 31, 2016, 5:24 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @dejayou
          last edited by strawberry 3.141 Jul 31, 2016, 5:25 PM Jul 31, 2016, 5:24 PM

          @dejayou i can find a couple of errors in your config

          module: 'alert',  // remove comma
          
          module: ‘wuforecast’, // you often used wrong single quotes
          
          {
          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
          }
          }, ]  // remove comma
          

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

          1 Reply Last reply Reply Quote 0
          • D Offline
            dejayou
            last edited by Jul 31, 2016, 7:49 PM

            Thanks Strawberry, I still seem to be having some issues and receiving the same error message even after I made these edits. Any chance you could take another quick look and see if anything here seems out of place?

            /* 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: “wuforecast”,
              position: “top_right”, // This can be any of the regions.
              // Best results in left or right regions.
              config: {
              // See ‘Configuration options’ for more information.
              location: “Cleveland”,
              appid: “5095830b868b90bcc31affdad4911325” //wunderground.com API key.
              }
              }, {
              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: “Cleveland”,
              locationID: “4614088”, //ID from bulk.openweather.org/sample/
              appid: “5095830b868b90bcc31affdad4911325”
              }
              }, {
              module: “weatherforecast”,
              position: “top_right”,
              header: “Weather Forecast”,
              config: {
              location: “Cleveland”,
              locationID: “4614088”, //ID from bulk.openweather.org/sample/
              appid: “5095830b868b90bcc31affdad4911325”
              }
              }, {
              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;
            }

            S 1 Reply Last reply Jul 31, 2016, 8:05 PM Reply Quote 0
            • S Offline
              strawberry 3.141 Project Sponsor Module Developer @dejayou
              last edited by Jul 31, 2016, 8:05 PM

              @dejayou you’re still using the wrong ones

              /* 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: 'wuforecast',
                  position: 'top_right', // This can be any of the regions.
                  // Best results in left or right regions.
                  config: {
                  // See ‘Configuration options’ for more information.
                  location: 'Cleveland',
                  appid: '5095830b868b90bcc31affdad4911325' //wunderground.com API key.
                  }
                  }, {
                  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: 'Cleveland',
                  locationID: '4614088', //ID from bulk.openweather.org/sample/
                  appid: '5095830b868b90bcc31affdad4911325'
                  }
                  }, {
                  module: 'weatherforecast',
                  position: 'top_right',
                  header: 'Weather Forecast',
                  config: {
                  location: 'Cleveland',
                  locationID: '4614088', //ID from bulk.openweather.org/sample/
                  appid: '5095830b868b90bcc31affdad4911325'
                  }
                  }, {
                  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 create a github issue if you need help, so I can keep track

              D 1 Reply Last reply Aug 1, 2016, 2:21 AM Reply Quote 0
              • D Offline
                dejayou
                last edited by Jul 31, 2016, 8:29 PM

                That’s odd. In the actual source code I am using the double quotes, but then in your yellow block text readout is somehow reverts back to single quotes in those same instances. Is this a Javascript thing?

                1 Reply Last reply Reply Quote 0
                • D Offline
                  dejayou @strawberry 3.141
                  last edited by Aug 1, 2016, 2:21 AM

                  @strawberry-3.141 So i’ve gone back through on the Linux system and checked that OS system and sure enough, when copying and pasting from a PC (here) and to a Linux, or vice versa, these quote marks have a tendency to alter.

                  At any rate, the code in the config file is now in a place where everything checks out ok in both the JSHint and JSLint tools, save for the last portion beneath the final line of demarcation where it reads not to edit the lines of code.

                  Here the error reads:

                  undeclared ‘module’.
                  if (typeof module !== “undefined”) {
                  unexpected ‘typeof’. Use ‘===’ to compare directly with undefined.
                  if (typeof module !== “undefined”) {
                  undeclared 'module"
                  module.exports = config;

                  Is this why the config file ultimately won’t be recognized by my raspberry pi/magic mirror program?

                  1 Reply Last reply Reply Quote 0
                  • K Offline
                    KirAsh4 Moderator
                    last edited by Aug 1, 2016, 3:45 AM

                    Do not copy/paste from one OS to another, the language translations between them will be different, UTF-8, Windows, it’s all foobar. Edit the config file ON the rpi. You can use the command 'nano' for that, as in 'nano config.js'. Doing the copy/paste is why your ‘'’, ‘"’ and others get translated wrong.

                    A Life? Cool! Where can I download one of those from?

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      dejayou
                      last edited by Aug 2, 2016, 3:08 AM

                      Thanks KirAsh4. I am assuming that you meant to open the actual Terminal and edit the config file directly from within that environment, which is what I did with still no luck.

                      At this point I really don’t know what else to do. I am going to try and essentially start over from the beginning and see if I have better luck.

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