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

Starting up MM via SSH don't work



  • Hello,
    This is my first post here, so I would like to greet everyone! 🙂

    So I installed MM on my PI 3 v1.2 year 2015, and I tried to start it via SSH.
    Of course I read manual and I’m trying to start it by DISPLAY=:0 npm start

    But it’s giving me this error

    root@raspberrypi:~/MagicMirror# DISPLAY=:0 npm start
    
    > magicmirror@2.4.1 start /root/MagicMirror
    > sh run-start.sh
    
    No protocol specified
    
    (electron:2352): Gtk-WARNING **: cannot open display: :0
    
    npm ERR! Linux 4.14.70-v7+
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
    npm ERR! node v4.2.1
    npm ERR! npm  v2.14.7
    npm ERR! code ELIFECYCLE
    npm ERR! magicmirror@2.4.1 start: `sh run-start.sh`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the magicmirror@2.4.1 start script 'sh run-start.sh'.
    npm ERR! This is most likely a problem with the magicmirror package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     sh run-start.sh
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls magicmirror
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /root/MagicMirror/npm-debug.log
    

    What is strange when I typed echo $DISPLAY on PI it showed value 0.0, so I also tried DISPLAY=:0.0 npm start but the result is still the same…

    Some specs:
    I’m using ssh via MacBook Pro Mid 2014, Mac OS High Sierra 10.13.6
    Fresh install of Rasbian Stretch, kernel 4.14.70-v7+

    Please help :C


  • Module Developer

    @grimorth said in Starting up MM via SSH don’t work:

    npm ERR! node v4.2.1
    npm ERR! npm v2.14.7

    You can certainly start by updating node, and thus, npm. It might even solve your issue.



  • @mykle1 Okay, that’s a good start, however I just messed up. I tried to update node, but it said that it’s already in the newest version (10.0) but as you pointed out npm shows 4.2.1, so I decided to completely remove node and install it again. I deleted some folders under /usr/local/lib and /usr/local/include, however it’s still shows that node is installed. Can you help me get rid of it and reinstall? Also maybe reinstall of whole MM would be helpful?



  • @grimorth Update. I managed to get rid of all node versions and installed 10.0 but I can’t start npm now. It says
    root@raspberrypi:~/MagicMirror# npm -v -su: /usr/local/bin/npm: No such file or directory

    I tried apt-get install npm but without luck…



  • Update.
    After reboot node and npm are up to date. However I still can’t start up MM via SSH. From PI terminal it works like a charm.

    root@raspberrypi:~/MagicMirror# DISPLAY=:0 npm start
    
    > magicmirror@2.4.1 start /root/MagicMirror
    > sh run-start.sh
    
    No protocol specified
    
    (electron:942): Gtk-WARNING **: cannot open display: :0
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! magicmirror@2.4.1 start: `sh run-start.sh`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the magicmirror@2.4.1 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2018-09-23T00_09_27_111Z-debug.log
    root@raspberrypi:~/MagicMirror# DISPLAY=:0.0 npm start
    
    > magicmirror@2.4.1 start /root/MagicMirror
    > sh run-start.sh
    
    No protocol specified
    
    (electron:965): Gtk-WARNING **: cannot open display: :0.0
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! magicmirror@2.4.1 start: `sh run-start.sh`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the magicmirror@2.4.1 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2018-09-23T00_09_42_728Z-debug.log
    

    Error log:

    root@raspberrypi:~/.npm/_logs# cat 2018-09-23T00_09_42_728Z-debug.log 
    0 info it worked if it ends with ok
    1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
    2 info using npm@6.4.1
    3 info using node@v10.11.0
    4 verbose run-script [ 'prestart', 'start', 'poststart' ]
    5 info lifecycle magicmirror@2.4.1~prestart: magicmirror@2.4.1
    6 info lifecycle magicmirror@2.4.1~start: magicmirror@2.4.1
    7 verbose lifecycle magicmirror@2.4.1~start: unsafe-perm in lifecycle true
    8 verbose lifecycle magicmirror@2.4.1~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    9 verbose lifecycle magicmirror@2.4.1~start: CWD: /root/MagicMirror
    10 silly lifecycle magicmirror@2.4.1~start: Args: [ '-c', 'sh run-start.sh' ]
    11 silly lifecycle magicmirror@2.4.1~start: Returned: code: 1  signal: null
    12 info lifecycle magicmirror@2.4.1~start: Failed to exec start script
    13 verbose stack Error: magicmirror@2.4.1 start: `sh run-start.sh`
    13 verbose stack Exit status 1
    13 verbose stack     at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
    13 verbose stack     at EventEmitter.emit (events.js:182:13)
    13 verbose stack     at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
    13 verbose stack     at ChildProcess.emit (events.js:182:13)
    13 verbose stack     at maybeClose (internal/child_process.js:962:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
    14 verbose pkgid magicmirror@2.4.1
    15 verbose cwd /root/MagicMirror
    16 verbose Linux 4.14.70-v7+
    17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
    18 verbose node v10.11.0
    19 verbose npm  v6.4.1
    20 error code ELIFECYCLE
    21 error errno 1
    22 error magicmirror@2.4.1 start: `sh run-start.sh`
    22 error Exit status 1
    23 error Failed at the magicmirror@2.4.1 start script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 1, true ]

  • Module Developer

    @grimorth

    Ok, now that your node and npm are up to date, I wouldn’t say reinstall MM just yet. Not until you’ve heard from a few others about your issue.

    In the meantime, would you try DISPLAY=:0 nohup npm start &

    I think that sh does not like DISPLAY=:0 npm start and will not work



  • @Mykle1 I tried your solution earlier but result was still the same.

    I also managed to fix everything 🙂
    I reinstalled whole rasbian, because I really messed up and when I tried to star MM directly on PI, it was showing only black screen. Then I installed MM directly on PI.
    Earlier I was installing it via SSH. Shouldn’t be the issue yet it was…
    Now everything runs smooth, I can start MM directly and via SSH with both commands DISPLAY=:0 nohup npm start & and DISPLAY=:0 npm start.

    Thanks for all support 🙂


  • Module Developer

    @grimorth

    Life is good. Enjoy!