How to make Electron run on Raspberry Pi

By | July 23, 2017

Electron is absolutely awesome thing! It’s easy for use of HTML, CSS and JavaScript, it’s crossplatform, and many others. And, how complicated is to make it run on Raspberry Pi? It’s pretty easy! Let’s install it!

Log in into SSH as user pi, and if you not have installed NodeJS, execute this: (in Putty/SSH, press right mouse button to paste):

cd /tmp
wget https://nodejs.org/dist/v8.2.1/node-v8.2.1-linux-armv7l.tar.xz
tar xfv node-v8.2.1-linux-armv7l.tar.xz
cd node-v8.2.1-linux-armv7l
sudo cp -R * /usr/local/

And now just download and install Electron

sudo npm install -g electron --unsafe-perm=true --allow-root

If you want to test it, install Electron quick start app

# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Set display
export DISPLAY=:0
# Run the app
npm start

EDIT 3rd October 2018:
I find out the latest version v3.X.X is not working, it’s showing blank window. After some research, I find out that I need to disable GPU acceleration. Instead of npm start, write:

electron main.js --disable-gpu

And it’s done! 🙂