MagicMirror² v2.8.0 is available! For more information about this release, check out this topic.

pm2 restarts magicmirror every few seconds



  • Hello.
    I fresh install Magicmirror on raspbian buster.
    when I reboot the system to see if everything work like it should I notice that magicmirror does not start at all.
    pm2 shows this:
    0_1565094216661_Screenshot 2019-08-06 at 15.19.17.png

    Id is constantly changing and restart count is increasing.
    It seems that magicmirror is trying to start but for some reason, can’t
    Any suggestions?



  • @panos do

    pm2 logs
    


  • PM2            | App [MagicMirror:0] exited with code [1] via signal [SIGINT]
    PM2            | App [MagicMirror:0] starting in -fork mode-
    PM2            | App [MagicMirror:0] online
    0|MagicMirror  | { Error: ENOENT: no such file or directory, open 'package.json'
    0|MagicMirror  |     at Object.openSync (fs.js:443:3)
    0|MagicMirror  |     at Object.readFileSync (fs.js:343:35)
    0|MagicMirror  |     at Object. (/home/pi/MagicMirror/js/app.js:15:32)
    0|MagicMirror  |     at Module._compile (internal/modules/cjs/loader.js:778:30)
    0|MagicMirror  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    0|MagicMirror  |     at Module.load (internal/modules/cjs/loader.js:653:32)
    0|MagicMirror  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    0|MagicMirror  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    0|MagicMirror  |     at Module.require (internal/modules/cjs/loader.js:692:17)
    0|MagicMirror  |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:70:37)
    0|MagicMirror  |   errno: -2,
    0|MagicMirror  |   syscall: 'open',
    0|MagicMirror  |   code: 'ENOENT',
    0|MagicMirror  |   path: 'package.json' }
    PM2            | App [MagicMirror:0] exited with code [1] via signal [SIGINT]
    PM2            | App [MagicMirror:0] starting in -fork mode-
    PM2            | App [MagicMirror:0] online
    
    
    0|MagicMirror  | { Error: ENOENT: no such file or directory, open 'package.json'
    0|MagicMirror  |     at Object.openSync (fs.js:443:3)
    0|MagicMirror  |     at Object.readFileSync (fs.js:343:35)
    0|MagicMirror  |     at Object. (/home/pi/MagicMirror/js/app.js:15:32)
    0|MagicMirror  |     at Module._compile (internal/modules/cjs/loader.js:778:30)
    0|MagicMirror  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    0|MagicMirror  |     at Module.load (internal/modules/cjs/loader.js:653:32)
    0|MagicMirror  |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    0|MagicMirror  |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    0|MagicMirror  |     at Module.require (internal/modules/cjs/loader.js:692:17)
    0|MagicMirror  |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:70:37)
    0|MagicMirror  |   errno: -2,
    0|MagicMirror  |   syscall: 'open',
    0|MagicMirror  |   code: 'ENOENT',
    0|MagicMirror  |   path: 'package.json' }
    

  • Project Sponsor

    PM2 is restarting the mirror because the mirror process keeps crashing. Let’s try a rebuild. Try this:

    pm2 stop all
    cd /home/pi/MagicMirror
    npm install
    pm2 start 0
    


  • I tried this with no luck:(
    The issue persists…

    -EDIT-
    I manage to resolve the issue:

    • pm2 delete MagicMirror
    • pm2 start /home/pi/MagicMirror/installers/mm.sh
    • pm2 save

    pm2 process name is now ‘mm’ instead of ‘MagicMirror’
    so
    “pm2 start|stop|restart mm” is now the command that I will use
    Thanks for your help!!
    Cheers:)



  • @panos yes, when doing install, it uses a config file which supplies a title. It’s in the installers folder