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

How to Troubleshoot

Scheduled Pinned Locked Moved Troubleshooting
10 Posts 8 Posters 36.6k Views 7 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.
  • B Offline
    Bangee Module Developer
    last edited by May 13, 2016, 12:31 PM

    Hey there beginners like me :-)

    I would like to show you, where and how to find errors while installing, using or developing MagicMirror 2.

    What we need:
    MagicMirror2 from github -> https://github.com/MichMich/MagicMirror installed on a Raspberry Pi.

    Try to use the automatic install as described in the Readme.md.

    A really good tool to see whats going on behind your MM2 is Firebug -> http://getfirebug.com/
    If you run you MM2 as node serveronly you will have a lot of informations.

    Connect to your Raspberry using Putty -> http://www.putty.org/
    Username: pi
    Password: raspberry

    1. Start StandaloneServer: node serveronly
    2. open your FirefoxBrowser http://192.168.0.150:8080 (replace your Raspy’s IP adresse)
    3. Press F12 to start Firebug

    If you are using PM2 you will get informations running these command:
    pm2 info mm (replace mm whit your App Name)

    Output:

    pi@raspberrypi:~ $ pm2 info mm
     Describing process with id 0 - name mm
    ┌───────────────────┬───────────────────────────────────┐
    │ status            │ online                            │
    │ name              │ mm                                │
    │ restarts          │ 5                                 │
    │ uptime            │ 3h                                │
    │ script path       │ /home/pi/mm.sh                    │
    │ script args       │ N/A                               │
    │ error log path    │ /home/pi/.pm2/logs/mm-error-0.log │
    │ out log path      │ /home/pi/.pm2/logs/mm-out-0.log   │
    │ pid path          │ /home/pi/.pm2/pids/mm-0.pid       │
    │ interpreter       │ bash                              │
    │ interpreter args  │ N/A                               │
    │ script id         │ 0                                 │
    │ exec cwd          │ /home/pi                          │
    │ exec mode         │ fork_mode                         │
    │ node.js version   │ N/A                               │
    │ watch & reload    │ ✘                                 │
    │ unstable restarts │ 0                                 │
    │ created at        │ 2016-05-13T08:30:59.308Z          │
    └───────────────────┴───────────────────────────────────┘
     Add your own code metrics: http://bit.ly/code-metrics
     Use `pm2 logs mm (--lines 1000)` to display logs
     Use `pm2 monit` to monitor CPU and Memory usage mm
    

    Here you’ll find again a lot of informations where to find your error_log or your out_log.

    If you create a console.log("something"); debug message or output you’ll be able to see this info using the following command:
    tail -f /home/pi/.pm2/logs/mm-out-0.log (replace the path with your paht to log or error file)

    This will be continued…

    so long Bangee…

    P 1 Reply Last reply May 20, 2016, 10:32 PM Reply Quote 2
    • M Offline
      MichMich Admin
      last edited by May 13, 2016, 12:47 PM

      Nice work! Feel free to add this to the wiki! :)

      1 Reply Last reply Reply Quote 1
      • P Offline
        paviro Admin @Bangee
        last edited by paviro May 23, 2016, 9:47 PM May 20, 2016, 10:32 PM

        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 your config.js (just paste its content into the website). You can of course also use firebug as stated above.

        We're all stories in the end. Just make it a good one, eh?

        – The Doctor

        1 Reply Last reply Reply Quote 1
        • Z Offline
          ZTA0796
          last edited by Dec 15, 2016, 10:54 PM

          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!

          1 Reply Last reply Reply Quote 0
          • B Offline
            Bangee Module Developer
            last edited by Jan 26, 2017, 8:16 AM

            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.

            1 Reply Last reply Reply Quote 0
            • A Offline
              alberttwong
              last edited by Jun 9, 2017, 12:34 AM

              Is there a way to see the log via a module?

              1 Reply Last reply Reply Quote 0
              • L Offline
                Lexingtonian
                last edited by Oct 22, 2017, 2:21 AM

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

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

                E 1 Reply Last reply Feb 9, 2018, 11:37 AM Reply Quote 3
                • E Offline
                  E3V3A @Lexingtonian
                  last edited by Feb 9, 2018, 11:37 AM

                  @Lexingtonian Thank you for that tip with npm run config:check. Should be in the dev docs…

                  "Everything I do (here) is for free – altruism is the way!"
                  MMM-FlightsAbove, MMM-Tabulator, MMM-Assistant (co-maintainer)

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mykle1 Project Sponsor Module Developer
                    last edited by Feb 9, 2018, 1:22 PM

                    https://forum.magicmirror.builders/topic/5399/how-to-check-your-config-for-errors-for-absolute-beginners

                    Create a working config
                    How to add modules

                    1 Reply Last reply Reply Quote 1
                    • E Offline
                      E3V3A
                      last edited by E3V3A Feb 28, 2018, 7:09 PM Feb 28, 2018, 7:08 PM

                      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 MM v2.2.2 (master).

                      "Everything I do (here) is for free – altruism is the way!"
                      MMM-FlightsAbove, MMM-Tabulator, MMM-Assistant (co-maintainer)

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