Testing electron app on Ubuntu linux is easy with VirtualBox and an Ubuntu ISO. All you need to do is some configuration to share your electron app between the host (your machine) and the guest (Ubuntu). The app we’ll be testing is the Electron hello world app that is covered in another tutorial.
1. Installing ubuntu
The installation process took a lot of space so it’s been published in its own Install Ubuntu on VirtualBox tutorial.
2. Sharing electron project folder from host
This is one way to do it. You could also add the electron app to a git repo and push it from the host and pull it down to guest machine. The approach described below makes it possible for you to test the app on Linux before committing the changes to the repo.
Make sure you have installed the guest additions as explained in step 1.
Click on the folder icon at the bottom of the virtual machine window and select Shared Folder Settings…
Then click on the green plus sign to the left. And set the Path to your electron project in Folder path. If you followed the Electron hello world the folder name will be called electron-hello-world
Create an empty directory in your home folder of Ubuntu. We will use this to mount our share folder in. I called mine electron-hello-world and added it to my home folder with the terminal:
next it is time to mount the share:
3. Install node.js and electron
To install Node.js on Ubuntu, type this in the terminal:
When done, run this command in a terminal to install electron globally:
4. Running you Electron app
Now you are ready to fire up the electron app.
type the following in the terminal:
That’s it for now. Next tutorial in this series is Electron app navigation.