<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Electron Error: Cannot open display :0]]></title><description><![CDATA[<p dir="auto">Dear all,<br />
I have tried to setup MM2 about 20 times by now and always run into exactly the same error:</p>
<pre><code>pi@MirrorPi:~ $ cd MagicMirror/
pi@MirrorPi:~/MagicMirror $ DISPLAY=:0 npm start

&gt; magicmirror@2.5.0 start /home/pi/MagicMirror
&gt; sh run-start.sh

(electron:24936): Gtk-WARNING **: cannot open display: :0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! magicmirror@2.5.0 start: `sh run-start.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the magicmirror@2.5.0 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/2018-10-03T21_35_33_903Z-debug.log
</code></pre>
<p dir="auto">The Log-File states:</p>
<pre><code>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.5.0~prestart: magicmirror@2.5.0
6 info lifecycle magicmirror@2.5.0~start: magicmirror@2.5.0
7 verbose lifecycle magicmirror@2.5.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle magicmirror@2.5.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/MagicMirror/node_modules/.bin:/usr/local/sb$
9 verbose lifecycle magicmirror@2.5.0~start: CWD: /home/pi/MagicMirror
10 silly lifecycle magicmirror@2.5.0~start: Args: [ '-c', 'sh run-start.sh' ]
11 silly lifecycle magicmirror@2.5.0~start: Returned: code: 1  signal: null
12 info lifecycle magicmirror@2.5.0~start: Failed to exec start script
13 verbose stack Error: magicmirror@2.5.0 start: `sh run-start.sh`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.&lt;anonymous&gt; (/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.&lt;anonymous&gt; (/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.5.0
15 verbose cwd /home/pi/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
</code></pre>
<p dir="auto">My setup process is:</p>
<ul>
<li>clean install of latest image of Raspian stretch</li>
<li>setup wifi, keyboard, CLI-boot</li>
<li>sudo apt-get update &amp;&amp; sudo apt-get upgrade</li>
<li>set memory-split to 256</li>
<li>activate Fake KMS</li>
<li>install latest versions of NodeJS (via apt-get) and npm (via npm)</li>
<li>install MM2 via <a href="http://raspberry.sh" target="_blank" rel="noopener noreferrer nofollow ugc">raspberry.sh</a> script</li>
</ul>
<p dir="auto">I do not get any error messages during setup.</p>
<p dir="auto">I also tried the manual setup several times with the same result and even tried different Pis, SD cards and Monitors. Setting up the system on-site or via SSH does not make a difference either.</p>
<p dir="auto">Searching the internet did not get me very far. What I tried without success:</p>
<ul>
<li><code>export DISPLAY=":0.0"</code></li>
<li><code>export DISPLAY=":0"</code></li>
<li><code>xhost +</code>–&gt; unable to open display “:0”</li>
<li><code>xhost local:root</code> --&gt; unable to open display “:0”</li>
<li><code>xhost +localhost</code> --&gt; unable to open display “:0”</li>
<li>adding <code>Defaults env_keep=DISPLAY</code> in /etc/sudoers</li>
<li>adding <code>export XAUTHORITY=$HOME/.Xauthority</code> in /home/pi/.bashrc</li>
</ul>
<p dir="auto">Do you have any idea how to solve this?</p>
]]></description><link>https://forum.magicmirror.builders/topic/8857/electron-error-cannot-open-display-0</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 10:24:37 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/8857.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Oct 2018 22:10:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Electron Error: Cannot open display :0 on Sun, 14 Oct 2018 15:39:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rudibarani" aria-label="Profile: rudibarani">@<bdi>rudibarani</bdi></a> i only do npm start from my ssh session</p>
<p dir="auto">do u have a keyboard on the pi?  if so, ctrl-alt-t will open a shell window… then u should be able to get to the previous command with up arrow…</p>
]]></description><link>https://forum.magicmirror.builders/post/45394</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45394</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 14 Oct 2018 15:39:06 GMT</pubDate></item><item><title><![CDATA[Reply to Electron Error: Cannot open display :0 on Sun, 07 Oct 2018 09:27:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bream" aria-label="Profile: bream">@<bdi>bream</bdi></a> <a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Thank you very much for your reply! This could be the right path! I have initially configured the Pi on the GUI surface (Wifi, Keyboard) and then switched to CLI boot. I have done this with my previous installations of MagicMirror without problems, as electron started the x-server as needed. This does not seem to work anymore…</p>
<p dir="auto">How do I revert this? I have changed back from CLI-boot to Desktop GUI in raspi-config. If I ssh into the pi and start MagicMirror via <code>DISPLAY=:0 npm start</code>, the application claims to start without problems:</p>
<pre><code>&gt; magicmirror@2.5.0 start /home/pi/MagicMirror
&gt; sh run-start.sh

Starting MagicMirror: v2.5.0
Loading config ...
Loading module helpers ...
No helper found for module: alert.
Initializing new module helper ...
Module helper loaded: updatenotification
No helper found for module: clock.
Initializing new module helper ...
Module helper loaded: calendar
No helper found for module: compliments.
No helper found for module: currentweather.
No helper found for module: weatherforecast.
Initializing new module helper ...
Module helper loaded: newsfeed
All module helpers loaded.
Starting server on port 8080 ... 
Server started ...
Connecting socket for: updatenotification
Connecting socket for: calendar
Starting node helper for: calendar
Connecting socket for: newsfeed
Starting module: newsfeed
Sockets connected &amp; modules started ...
Launching application.
</code></pre>
<p dir="auto">Unfortunately, the display still just shows the GUI of the operation system.<br />
Could you please help me from here?</p>
<p dir="auto">Thank you very much!</p>
]]></description><link>https://forum.magicmirror.builders/post/45095</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45095</guid><dc:creator><![CDATA[rudibarani]]></dc:creator><pubDate>Sun, 07 Oct 2018 09:27:12 GMT</pubDate></item><item><title><![CDATA[Reply to Electron Error: Cannot open display :0 on Fri, 05 Oct 2018 13:30:31 GMT]]></title><description><![CDATA[<p dir="auto">I am now :)</p>
]]></description><link>https://forum.magicmirror.builders/post/45017</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45017</guid><dc:creator><![CDATA[bream]]></dc:creator><pubDate>Fri, 05 Oct 2018 13:30:31 GMT</pubDate></item><item><title><![CDATA[Reply to Electron Error: Cannot open display :0 on Fri, 05 Oct 2018 12:33:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rudibarani" aria-label="Profile: rudibarani">@<bdi>rudibarani</bdi></a> said in <a href="/post/44969">Electron Error: Cannot open display :0</a>:</p>
<blockquote>
<p dir="auto">setup wifi, keyboard, <strong>CLI-boot</strong></p>
</blockquote>
<p dir="auto">you ARE running the GUI desktop, right… NOT commandline.</p>
]]></description><link>https://forum.magicmirror.builders/post/45015</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45015</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Fri, 05 Oct 2018 12:33:36 GMT</pubDate></item><item><title><![CDATA[Reply to Electron Error: Cannot open display :0 on Fri, 05 Oct 2018 12:01:38 GMT]]></title><description><![CDATA[<p dir="auto">I had the same error, and the problem turned out to be that on first boot I had decided to reconfigure the pi to boot to the console rather than the desktop. Consequently I didn’t have a x server running (doh!)<br />
You didn’t mention that as one of your setup steps, but I though it might be worth mentioning.</p>
]]></description><link>https://forum.magicmirror.builders/post/45011</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45011</guid><dc:creator><![CDATA[bream]]></dc:creator><pubDate>Fri, 05 Oct 2018 12:01:38 GMT</pubDate></item></channel></rss>