Read the statement by Michael Teeuw here.
How to Troubleshoot
-
Nice work! Feel free to add this to the wiki! :)
-
You could also use
pm2 logs mm
to get the logs! A bit easier than remembering the file path :)If you have any problems regarding a
black screen
, always make sure to use jslint.com to validate yourconfig.js
(just paste its content into the website). You can of course also usefirebug
as stated above. -
If I am debugging code I am writing, is the easiest way to:
-save the module.js files
-run “pm2 restart mm”
-run “pm2 logs mm”Or is there a different command that will update the code and how the system in running on the fly without having to restart the mirror each time?
Thanks!
-
you can test your software in a browser using the webserver:
http://mirror_ip_adress:8080
install in firefox a tool called
Firebug
https://addons.mozilla.org/de/firefox/addon/firebug/
it will show you errors on the fly.
Changes in node_helper.js requires a restart of your mirror software. -
Is there a way to see the log via a module?
-
One command that has been a lifesaver for me when I’ve munged up the config.js is: “npm run config:check”. The key is to be in the MagicMirror directory when you run it. It’ll check out your config.js and is much more convenient than pasting into jslint.com.
For example here is one instance when I had multiple issues and even left the letter “v” at the bottom of my config.js file (on line 255). I would have never found that…The symptom was some modules would load and other would just say “loading” perpetually.
pi@raspberrypi:~/MagicMirror $ npm run config:check
magicmirror@2.1.3 config:check /home/pi/MagicMirror
node tests/configs/check_config.jsChecking file… /home/pi/MagicMirror/config/config.js
Line 201 col 24 Duplicate key ‘classes’.
Line 223 col 20 Duplicate key ‘classes’.
Line 255 col 1 Expected an assignment or function call and instead saw an expression.
Line 255 col 2 Missing semicolon. -
@Lexingtonian Thank you for that tip with
npm run config:check
. Should be in the dev docs… -
-
While trying to debug modules, I’ve been given quite mixed feedback regarding what to use to print messages to console, on either local system or in remote browser DevTools.
So far, I have found the only reliable way that always seem to print something in the browser, is using
console.error()
. The others have varied. I’m on MMv2.2.2 (master)
.