Read the statement by Michael Teeuw here.
Config.js file Syntax
-
@Mykle1 did that and when I open the Index.html it’s still showing me the same issue " create a config file - if you get this message while your config file is already created, your config file probably contains an error…"
I have a Raspberry pi b+
Have all node and npm installed and updated,-
Trying to run it in server mode only with "
node serveronlybut when I “point my browser” to ```
http://localhost:8080 I receive this message " Your device is not allowed to access your mirror, please check you config.js file…" -
Tried PM2 start mm… and says that "mm’s status is online, mode is fork, and that process is successfully started but I don’t see any Magic Mirror showing up.
-
tried npm start no luck
-
-
@amosh83 said in Config.js file Syntax:
@Mykle1 did that and when I open the Index.html it’s still showing me the same issue " create a config file - if you get this message while your config file is already created, your config file probably contains an error…"
The config.js file I posted works. I just tested it. It’s a copy of the config.js.sample file that comes with the installation of MM. Make a copy of yours and rename it and try that. If what I posted still reports that error then something is going wrong in the way that you are creating the config.js file using it, or where you are putting the file.
I have a Raspberry pi b+
Have all node and npm installed and updated,Trying to run it in server mode only with " node serveronly but when I “point my browser” to ```
http://localhost:8080 I receive this message " Your device is not allowed to access your mirror, please check you config.js file…"You likely need to whitelist the IP address of the computer you’re using to access the mirror. See this line in the config.js file that I posted originally.
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.Tried PM2 start mm… and says that "mm’s status is online, mode is fork, and that process is successfully started but I don’t see any Magic Mirror showing up.
pm2 start mmtakes a few moments to run the mirror, maybe longer on a Pi b+. I’d wait 30 seconds before cancelling that command.tried npm start no luck
Has to be run in the MagicMirror directory only.
Really, you should post your terminal errors and console errors.
-
@amosh83 - Well, progress. You have a
config.jsfile in the right place and it’s passing the syntax checks. Let’s start at basic functionality and move to a working mirror.First, edit your
config.jsto allow everyone to connect and see the interface. Change this line:
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.
to read like this:
ipWhitelist: [],Next, let’s turn off pm2 management:
pm2 stop mm
And finally, let’s start the server and see if you can get an interface:cd /home/pi/MagicMirror node serveronlyWatch for any lines that say “error”. Don’t worry about lines that say “warn”. Once the console stops spitting out lines of text, try to view your pi in your browser. If you’re using the browser on the pi, then
http://localhost:8080should work. If you’re using the browser on another computer, thenhttp://(pi ip address):8080should work. You should see a basic mirror interface in your web browser.Give it a go and let us know if you have any success. We’ll get the fullscreen interface up afterwards.
-
@bhepler hello, Thank you for the detailed instructions so far, that’s exactly the kind of guidance I needed based on my level of knowledge… I did all the steps and everything was going smooth until my last step where I see the usual black screen
“Magic Mirror2
Please create a config file.
See README for more information.
If you get this message while your config file is already
created, your config file probably contains an error.
Use a JavaScript linter to validate your file”here’s a copy of my current config.js file with the ipwhitelist edit you suggested…
* MIT Licensed. */ var config = { port: 8080, ipWhitelist: [], // Set [] to allow all IP addresses. 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: "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: "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;}thank you
-
That config is fine. I just tested it. I don’t mean to intrude but is your config,js file in the correct directory? MM should have no problem with that config, unless it couldn’t find it.

-
Huh, according to your config you use the same locationID that I do. Welcome to NYC! :-)
-
@Mykle1 Yes, the file is there, same directory as the one shown above
-
@Mykle1 I just didn’t modify a thing from that file, just to make it work, once I see it up and running I’ll slowly customize it. I’m in Pennsylvania :)
-
@bhepler said in Config.js file Syntax:
@amosh83 - Well, progress. You have a config.js file in the right place and it’s passing the syntax checks.
Maybe I should have paid more attention while reading. I see now that I asked something that you had already established. My bad.
I am extremely curious to see how MM can report
"Please create a config file. See README for more information. If you get this message while your config file is already created, your config file probably contains an error."when there is a working config in the proper directory. -
@amosh83 Did you post the exact config.js file. If so you’re missing a “/” on the first line.
-
-
@amosh83 said in Config.js file Syntax:
all I was missing was that “/”,
Ahh, you missed when you copied and pasted. That’s fairly common.
are you kidding me???
Now where have I heard this before? Oh yeah, I said it!
Enjoy your mirror
-
I’m having this exact problem, but I’ve used a linter to check for errors and there are none, and my file is in /var/www/html/MagicMirror/config/config.js, I have no idea what I’m doing wrong!
-
@jade said in Config.js file Syntax:
my file is in /var/www/html/MagicMirror/config/config.js,
Your installation of MM belongs as follows, and so the path to your config.js file
pi@raspberry ~/MagicMirror/config/config.js
Then we can work on your config.js if need be
-
@Mykle1 not necessarily, you can install the mirror in every directory you like
-
@strawberry-3.141 … except for directories with different read/write permissions. Not a linux expert, but I guess this includes /var/ in its default status!?
-
I was referring to this forums very own “Complete Setup Tutorial.” Specifically, this:
https://forum.magicmirror.builders/topic/236/complete-setup-tutorial/6I guess I shouldn’t assume that everyone follows the installation procedure.
-
@Mykle1 said in Config.js file Syntax:
Your installation of MM belongs as follows, and so the path to your config.js file
pi@raspberry ~/MagicMirror/config/config.js
When I first started using Linux I was taught the very bad habit of switching to the root user and doing everything as root, so I moved the file into where it needs to be in /home/pi but I still have the same problem
var config = { port: 8080, ipWhitelist: [], language: "en", timeFormat: 24, units: "metric", modules: [ { module: "clock", position: "top_left" }, { module: "calendar", header: "CWG Pi", position: "top_left", config: { calendars: [ { symbol: "calendar-check-o ", url: "https://calendar.google.com/calendar/ical/cwgpi2017%40gmail.com/private-b287e4ebe0e8f5d66665e0c83f9e3fa0/basic.ics" } ] } }, { module: "compliments", position: "lower_third", updateInterval: 3600000, config: { compliments: { morning: [ "Valar Morghulis", "Valar Dohaeris", "When You Play The Game Of Thrones You Win Or You Die", "Where Is The God Of Tits And Wine?" ], afternoon: [ "Sometimes, Those With The Most Power Have The Least Grace", "A Mind Needs Books Like A Sword Needs A Whetstone", "Chaos Isn't A Pit, Chaos Is A Ladder", "A Lion Doesn't Concern Himself With The Opinions Of Sheep" ], evening: [ "The Night Is Dark And Full Of Terrors", "Night Gathers And Now My Watch Begins", "Winter Is Coming", "Power Resides Where Men Believe It Resides. It's A Trick, A Shadow On The Wall, And A Very Small Man Can Cast A Very Large Shadow" ] } } }, { module: "currentweather", position: "top_right", config: { location: "Corby", locationID: "2652381", //ID from http://www.openweathermap.org/help/city_list.txt appid: "39ab36a3fa513354fbe406263f175c07" } } ] };Everything is ok according to jslint but something has got to be not working. Incidentally if I use the sample file and don’t change anything I have the same problem.
-
@jade said in Config.js file Syntax:
When I first started using Linux I was taught the very bad habit of switching to the root user and doing everything as root, so I moved the file into where it needs to be in /home/pi but I still have the same problem
Again, I hate to refer to the Complete Setup Tutorial but item #7 of Notes at the very beginning of the tutorial states:
"DO NOT INSTALL MagicMirror² as the root user! Always do it as the regular, non privileged pi user"With that said, your config is not the problem. I just tested it and it fired right up.

Unless, it’s not named correctly (config.js) or MM can’t find it at its proper path
-
@Mykle1 I’m wondering if the problem was actually that I was using a Pi 0, I’m testing now on a Pi 2 and I’ve run the automatic installer, though it is now just sitting doing absolutely nothing, the last thing it said is:
>node-gyp rebuild > build_log.txt 2>&1 || exit 0And now it’s just sitting there. It hasn’t bought the prompt back up yet so maybe I’m being impatient.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login