UNSOLVED (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0
I have just installed magic mirror using the script provided on the github on my new Raspberry Pi 4b+.
I followed the pm2 and autostart method. However magicmirror keeps on restarting itself every 2-3 seconds.
I stopped it using pm2 stop Magicmirror and went onto the MagicMirror directory and manually tried to start it by this command “npm start dev”. I get the same errors as before when I check my pm2 logs MagicMirror. These are:
pi@raspberrypi:~/MagicMirror $ npm start dev > firstname.lastname@example.org start /home/pi/MagicMirror > sh run-start.sh "dev" (electron:2910): Gtk-WARNING **: 14:16:40.324: cannot open display: :0 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! email@example.com start: `sh run-start.sh "dev"` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the firstname.lastname@example.org 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! /home/pi/.npm/_logs/2019-12-19T14_16_40_381Z-debug.log
The xxxxx-debug.log file contains the following:
0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start', 'dev' ] 2 info using email@example.com 3 info using firstname.lastname@example.org 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle email@example.com~prestart: firstname.lastname@example.org 6 info lifecycle email@example.com~start: firstname.lastname@example.org 7 verbose lifecycle email@example.com~start: unsafe-perm in lifecycle true 8 verbose lifecycle firstname.lastname@example.org~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 9 verbose lifecycle email@example.com~start: CWD: /home/pi/MagicMirror 10 silly lifecycle firstname.lastname@example.org~start: Args: [ '-c', 'sh run-start.sh "dev"' ] 11 silly lifecycle email@example.com~start: Returned: code: 1 signal: null 12 info lifecycle firstname.lastname@example.org~start: Failed to exec start script 13 verbose stack Error: email@example.com start: `sh run-start.sh "dev"` 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:198:13) 13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:198:13) 13 verbose stack at maybeClose (internal/child_process.js:982:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid firstname.lastname@example.org 15 verbose cwd /home/pi/MagicMirror 16 verbose Linux 4.19.75-v7l+ 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" "dev" 18 verbose node v10.18.0 19 verbose npm v6.13.4 20 error code ELIFECYCLE 21 error errno 1 22 error email@example.com start: `sh run-start.sh "dev"` 22 error Exit status 1 23 error Failed at the firstname.lastname@example.org start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]
Can someone please help me?
@bachoo786 you cannot run this over ssh, display 0 is the actual display screen connected to the pi hdmi port
if u are running in console (text) mode, then you must run in serveronly, and use a browser from some other system …
I have my 4b running MM without problem, altho I used the updated install script (to be the official version on next release)
see here https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer
@sdetweil I suppose I would look stupid to tell you that at the moment I have not connected my rpi 4b to any display. Could that be answer?
@bachoo786 Hm… could be,that would be no display 0 (i hate it when the computers get it right!)
if u want to see it from some other system, then do
cd ~/MagicMirror node serveronly
it will tell you what IP address to put into the browser on your other system
@sdetweil right ok make sense.
to be fair the instrcutions on github on installing MagicMirror are little confusing as the installation script asks you if you want to use pm2 and when you say yes it should automatically run magicmirror via pm2.
however there is this link (https://github.com/MichMich/MagicMirror/wiki/Auto-Starting-MagicMirror) on the github explaining how to auto starting the magic mirror. And when you follow this link you end up having two instances of magic mirror on pm2 i.e. MagicMirror and mm. Thats confusing!
Do I still have to follow the autostarting magicmirror link? or is the install script sufficient?
@bachoo786 install script does it for you…
@bachoo786 could you do me a favor before u plug in a monitor,
can you do
from the ssh terminal…
I’m guessing it should return nothing…
my new run-start.sh script in next release, will detect text mode and start your installation in serveronly automagically.,! (pm2 just starts the script)
@sdetweil yeah it returned nothing.
so shall I follow your script i.e. https://forum.magicmirror.builders/topic/10171/anyone-want-to-try-updated-installer
and reinstall MagicMirror?
Do I have to worry about installing pm2? will Magic Mirror run automatically if I was to reboot my raspberry? etc?
to be fair I want to install and run Magic Mirror on my raspberry. I suppose that is server mode? and not client mode? whats the difference sorry ?
@bachoo786 you don’t need to reinstall… you are ok… just need a display on the 4 or run server only…
the new code isn’t used on my install except for pi0, which won’t work anymore without some changes
yeah it returned nothing.