Read the statement by Michael Teeuw here.
Trouble with config file, Error Create Config File
-
So when I boot up the mirror I get the unable to validate config error, and gives me a need to create config screen when booted. How do I fix?
/* Magic Mirror Config Sample * * By Michael Teeuw http://michaelteeuw.nl * MIT Licensed. */ var config = { port: 8080, ipWhitelist: ["::ffff:192.168.1/24", "127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses. 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://p55-calendars.icloud.com/published/2/TDWYwJjbv2BpxxxxxxxxxxvpNrb4SlxsvZM-xxxxxxx\" } ] } }, { module: "compliments", position: "lower_third" }, { module: "currentweather", position: "top_right", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "1b3ccd1809XXXXXXXXb5830e444aa1" } }, { module: "weatherforecast", position: "top_right", header: "Weather Forecast", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "1b3ccd1809XXXXXXXXb5830e444aa1" } }, { 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;}
-
@twosix said in Trouble with config file, Error Create Config File:
How do I fix?
Here! I did it for you. You had some crazy quote characters and a missing quote at the end of your calendar url. Just put your API back in for weather.
var config = { port: 8080, ipWhitelist: ["::ffff:192.168.1/24", "127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses. 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://p55-calendars.icloud.com/published/2/TDWYwJjbv2BpM3HLonfCqBBO$" } ] } }, { module: "compliments", position: "lower_third" }, { module: "currentweather", position: "top_right", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "YOUR API KEY" } }, { module: "weatherforecast", position: "top_right", header: "Weather Forecast", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "YOUR 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;}
-
@Mykle1 Thank you, but that didn’t work…I looked back at my code and realized that the full calendar link got cut off, and it did have a quote on the end of it…so I am still not sure what is happening, thanks though!
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://p55-calendars.icloud.com/published/2/TDWYwJjbv2BpM3HLxxxxxxxxxxxxxxxxxvZM-3TNpXNgZXsi192SI7M6pxxxxxxxxxxxxxxxxxxxxxxxXZCkcApre7Kg\" } ] } }, { module: "compliments", position: "lower_third" }, { module: "currentweather", position: "top_right", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "1b3ccd18090bb8048b4bb5830e444aa1" } }, { module: "weatherforecast", position: "top_right", header: "Weather Forecast", config: { location: "", locationID: "4460243", //ID from http://www.openweathermap.org/help/city_list.txt appid: "1b3ccd18090bb8048b4bb5830e444aa1" } }, { 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 } }, ]
-
@twosix said in Trouble with config file, Error Create Config File:
Thank you, but that didn’t work
Uhh, I used that config and it fired up just fine
-
@twosix said in Trouble with config file, Error Create Config File:
I get the unable to validate config error, and gives me a need to create config screen when booted. How do I fix?
The “need to create config” error message usually means that you have not copied the example configuration file to the production file. You’ll want to copy the
config.js.sample
file to it’s final destination ofconfig.js
. You can use this command (assuming you haven’t changed the paths and you’re using a standard Raspberry Pi):
cp /home/pi/MagicMirror/config/config.js.example /home/pi/MagicMirror/config/config.js
-
Yes you must do a cp to have a config.js to start with BUT before you make changes ALWAYS have a backup that works… ALWAYS.
IF you’re not sure and you’re having config.js problems run it through here …
http://esprima.org/demo/validate.html
It will tell you where your errors are… I mean it’s nice of people to fix things but if you’re working on this at 2AM and nobody is here… you’re not getting your mirror to work until the next day ;)
-
@Mykle1 I did the same, I fired up the sample config and it worked fine, but then after I put my stuff in, it gave me the “WARNING? Could not validate config file. Please correct syntax errors. Starting with default configuration.”
And then when I loads up it says, “Please create config file.”
-
@cowboysdude Thank you, I ran that through my code and there appears to be no problems…I just can’t figure out what the problem is…I boot the mirror up normally by going:
cd Magic Mirror
npm startand then I get the “WARNING? Could not validate config file. Please correct syntax errors. Starting with default configuration.”
and then when it loads the “Please create config file.”
-
@bhepler Thank you! I did this and it reset my config file, and that booted up fine, but when I put my information in, and started it:
cd MagicMirror
npm startI got the "WARNING? Could not validate config file. Please correct syntax errors. Starting with default configuration.”
Then load it said “Please create config file.”
-
@twosix said in Trouble with config file, Error Create Config File:
it worked fine, but then after I put my stuff in
Please correct syntax errors.If the default config works then this should be telling you that you are not making config entries correctly. Start again from the default config, making sure it runs, then add one module at a time, making sure it still works after each entry, then backing up your config each time you successfully add a module. I don’t know what else to offer you. I fixed your first config and tested it.