MagicMirror 2 only works with DISPLAY=:0 npm start command

  • Hello,
    I have installed raspbian jessie on my rpi2. I followed the website tutorial to do everything since I am a noob EXCEPT the part where magic mirror is to be installed. I followed the automatic method of Magicmirror’s github page.
    Then I put it in kiosk mode and did the last bits (more on that below) as per the howchoo site. End result? rpi boots and starts a web page with only the index visible. If I run the command DISPLAY=:0 npm start then it works.

    About the last bits after installing the MagicMirror in the automatic way: This is what I did:

    Turn Chromium into a kiosk

    Now we’ll configure Chromium to run in kiosk mode.

    Open the autostart config file in the Nano editor.

    Config file for Jessie:

    sudo nano ~/.config/lxsession/LXDE-pi/autostart

    Disable the screensaver
    For both Wheezy and Jessie, comment out the following line using a hash symbol (#):

    # @xscreensaver -no-splash

    Launch Chromium on startup in kiosk mode
    For Wheezy, add the following lines to the bottom of the file:

    @xset s off
    @xset -dpms
    @xset s noblank
    @unclutter -idle 1
    /usr/bin/chromium --kiosk --ignore-certificate-errors --disable-restore-session-state "http://localhost"

    For Jessie, add the following lines to the bottom of the file:

    @xset s off
    @xset -dpms
    @xset s noblank
    @unclutter -idle 1
    @chromium-browser --incognito --kiosk http://localhost/

    To exit, press CTRL-X, type Y and press enter.

    Next, we need to modify the Pi’s BIOS settings for a little extra awesomeness.

    Open BIOS config:

    sudo nano /boot/config.txt

    Use portrait monitor orientation
    Add the following line to rate the display 90 degrees:


    To rotate in the other direction (270 degrees), use the following line instead:


    Enable HDMI hotplugging
    Uncomment the following line:


    Save and exit. Finally, reboot your Pi once more:

    sudo reboot

    Please help.


    Note from admin: Please use Markdown on code and shell snippets!

  • @mihirjain that tut is outdated, beter install Version 2.
    It is beter to start with Clean install of Jessy.

    Walk through the readme and wiki!

  • Moderator

    Or follow the extensive step by step tutorial here:

  • @Wilco89 Thanks for the reply, though I didnt use the howchoo method for installation. I followed the github MagicMirror2 site method with the command

    curl -sL | bash

  • @KirAsh4
    Thanks for the reply, I used the same command to install mm2 as per your detailed tutorial. Though some commands after installed mm2 were different so shall retry the whole thing.


Log in to reply

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.