MagicMirror² v2.4.1 is available! For more information about this release, check out this topic.
Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!

npm start and black screen



  • Here is the log:

    Sockets connected & modules started ...
    Whoops! There was an uncaught exception...
    { Error: listen EADDRINUSE 0.0.0.0:8080
        at Object.exports._errnoException (util.js:1026:11)
        at exports._exceptionWithHostPort (util.js:1049:20)
        at Server._listen2 (net.js:1253:14)
        at listen (net.js:1289:10)
        at net.js:1399:9
        at _combinedTickCallback (internal/process/next_tick.js:77:11)
        at process._tickCallback (internal/process/next_tick.js:98:9)
        at Module.runMain (module.js:592:11)
        at run (bootstrap_node.js:402:7)
        at startup (bootstrap_node.js:157:9)
      code: 'EADDRINUSE',
      errno: 'EADDRINUSE',
      syscall: 'listen',
      address: '0.0.0.0',
      port: 8080 }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    Launching application.
    Shutting down server...
    
    

    How to fix this?

    Note : Use “pm2 start mm” is able to run mm.



  • @dexterbeng
    I found the problem issue https://forum.magicmirror.builders/topic/2209/error-listen-eaddrinuse-help-plox

    So i use pm2 stop mm, then i can use back npm start since no application is using port:8080.

    But still, is there anyone can explain to me, why my pm2 start mm is take while to boot up my mm, even i ctrl+q, it will turn mm back very long time or never turn on again?



  • @dexterbeng If you have pm2 and the mm script installed, it’s simplest to use pm2 start/stop mm. However, npm start dev is still useful to debug server and client consoles, just don’t forget to first pm2 stop mm as you describe.



  • @ninjabreadman
    Ya, agree with that pm2 is the easier way.
    By the way, can I know when you using pm2 to start your mm and you ctrl+q to quit it, how long it takes to auto boot it up again?
    For me, it likes 15 seconds to 30 seconds, and sometimes never turn on again…



  • @dexterbeng I would guess 15-30 seconds. pm2 has to detect that the process has terminated and restart. It depends on the polling interval for pm2 (which, as far as I can tell from their docs/issues, is 100ms, and cannot be changed – seems more frequent than I expected).

    Why are you killing mm with Ctrl+Q? Better to use pm2 restart mm or even pm2 start mm --watch which will also restart mm after file system changes (you may need to configure which directories to watch).