node serveronly works, but npm start doesn't



  • How can I go about diagnosing an issue where node serveronly works fine, but npm start (whether on a terminal or via pm2) fails silently? The only log information from npm is this:

    > magicmirror@2.10.0 start /home/pi/MagicMirror
    > ./run-start.sh
    [15:42:38.586] [LOG]    Starting MagicMirror: v2.10.0
    [15:42:38.595] [LOG]    Loading config ...
    [15:42:38.600] [LOG]    Loading module helpers ...
    [15:42:38.689] [LOG]    Initializing new module helper ...
    [15:42:38.690] [LOG]    Module helper loaded: MMM-Remote-Control
    
    (process terminates)
    

    It’s something to do with the MMM-PIR-Sensor module – removing it from config fixes npm start – but the module works fine in node serveronly mode, so I am having trouble identifying the problem.



  • @nealterrell did u install 2.10 or upgrade? Did u use one of the scripts?

    What pi is this

    run-start.sh had been updated to auto detect serveronly in config.js, or on systems where electron doesn’t work.

    Edit the run-start.sh and add a space and -x to the first line

    And then do npm start



  • @sdetweil Thank you for your reply. Raspberry Pi 4. Initially I upgraded with git pull && npm install, but I found your upgrade script and ran that. Now I added -x to run-start, and this is the output:

    > magicmirror@2.10.0 start /home/pi/MagicMirror
    > ./run-start.sh
    
    + ./untrack-css.sh
    + '[' -z :0.0 ']'
    ++ uname -m
    + arch=armv7l
    + false=false
    ++ grep -v '^\s//' config/config.js
    ++ grep -i serveronly:
    ++ awk '{print tolower($2)}'
    ++ tr -d ',"'\'''
    + serveronly=
    + serveronly=false
    ++ pgrep Xorg
    + xorg=454
    ++ uname
    + mac=Linux
    + '[' false. '!=' false. -o armv7l == armv6l ']'
    + '[' 454. == . -a Linux '!=' Darwin ']'
    + electron js/electron.js
    [17:16:24.796] [LOG]    Starting MagicMirror: v2.10.0
    [17:16:24.810] [LOG]    Loading config ...
    [17:16:24.820] [LOG]    Loading module helpers ...
    [17:16:24.948] [LOG]    Initializing new module helper ...
    [17:16:24.949] [LOG]    Module helper loaded: MMM-Remote-Control
    

    I added some logging to app.js where it loads modules, and the process terminates on the line Module = require(helperPath) when helperPath is the MMM-PIR-Sensor module.

    I don’t expect you to diagnose every misbehaving module, so I’ll continue to dig and see what went wrong. Any advice would be appreciated; especially regarding why there’s no issue with node serveronly.



  • @sdetweil I found that MMM-PIR-Sensor was failing when requiring onoff, so I wiped its node_modules, npm install, and now everything is fine. Sorry for wasting your time!



  • @nealterrell but my script was supposed to run the npm install for you.

    Can u send me the installers/upgrade.log

    Same Id as here on Gmail. Thx