diff --git a/Module-Debugging.md b/Module-Debugging.md new file mode 100644 index 0000000..5dd4fdf --- /dev/null +++ b/Module-Debugging.md @@ -0,0 +1,33 @@ +### How to debug your module while in development? + +As it can take several seconds and even minutes to restart your MM, it may be a bottleneck for development efficiency. Here are a (very) few suggestions to help debug your MM Module while under development. + +There are at least 2-3 ways to [test modules](https://forum.magicmirror.builders/topic/86/how-to-troubleshoot/7): + +1. Directly on MM itself (native mode) +2. Directly on MM itself (server mode) +3. As a node server or on a different machine [TBA] + +---- + +#### General Debug Tips + +* Run your MM in *server mode*, so that you still can use your RPi (or what have) in GUI mode, this also reduces it's CPU resources somewhat. +* Disable all other modules (except clock) to make it start/run faster and to isolate your Dev Module +* Use your browsers' `Developer Tools` (usually activated by `CTRL-SHIFT-i`) to check/debug JS etc. +* Check your JS code with some external site, like [jslint](http://jslint.com/) +* Check your JS code with some GUI (*Visual Studio*?) or command line utility... [TBA] +* Check your PM2 logs with `pm2 logs mm` or check the log files in their locations: + + - `/home/pi/.pm2/pm2.log` + - `/home/pi/.pm2/logs/mm-error-0.log` + - `/home/pi/.pm2/logs/mm-out-0.log` + +* Finally, and most useful, check the entire *npm* configuration with: `npm run config:check` + +```bash +cd ~/MagicMirror/ +npm run config:check +``` + +There are probably many other and better ways to check and debug. So please add and edit this page or file an issue with info for improving debugging.