Exploring the Electron application framework
Porting
You can port the boilerplate app from Figure 2 to other desktop systems using the forge package
command. Without specifying options, the command (under Ubuntu 16.04) creates a standalone version for Linux and the existing x64 processor architecture in the out/app-linux-x64
subdirectory of the app
project folder. In addition to the approximately 80MB executable app
in ELF format, this directory also contains other binary files. You will find the web application and the required node packages under resources/app
. After switching to the directory, the ./app
command starts the app in the shell, which looks exactly like Figure 2.
You can port the app to Windows using the --platform
command-line switch in the forge package --platform win32
command. This command creates the app for 64-bit Windows in the out/app-win32-x64
folder. In addition to the executable app.exe
, the distribution contains a large number of Windows DLLs and the resources
folder, which is more or less bit-identical to the matching folder for Linux.
If you copy the folder from Linux to a Windows 10 system and start the app, you won't see any notable differences with Figure 2. Conversely, you could install electron-forge
under Windows 10, and, in that case, the Linux app created under Windows will run under Linux.
You can assign a processor architecture with the arch
command-line switch. Table 1 shows the possible combinations of values for platform
and arch
.
Table 1
Electron Compatibility
System | Version | IA-32 | x64 | ARMv7l | ARM64 |
---|---|---|---|---|---|
Ubuntu |
>=12.04 |
Yes |
Yes (tested) |
Yes |
Yes |
Debian |
8 |
Yes |
Yes |
Yes |
Yes |
Fedora |
21 |
Yes |
Yes |
Yes |
Yes |
Windows |
>=7 |
Yes |
Yes (tested) |
Yes |
Yes |
OS X |
>=10.9 |
No |
Yes |
No |
Yes |
Packing
forge
offers to create platform-specific package formats or installers to facilitate easy distribution of the app (Table 2). forge make
generates a Debian package for the Boilerplate app. However, the script terminated in our lab while trying to create an RPM package, with the error message from Figure 3. sudo apt-get install rpm
fixed the problem.
Table 2
Possible Package Formats under forge
Type | System | Description |
---|---|---|
zip |
All |
Zip archive |
squirrel |
Windows |
Installer for Squirrel-Dot-Windows |
appx |
Windows |
Windows-Store packet |
dmg |
OS X Darwin |
DMG packet |
deb |
Linux |
Debian packet |
rpm |
Linux |
RPM packet |
flatpack |
Linux |
Flatpack packet |
![](/var/linux_magazin/storage/images/issues/2017/210/electron/figure-3/725204-1-eng-US/Figure-3_large.png)
Similar scenes occurred while trying to create a Windows installer with the forge make --platform win32
command. In this case, .NET support was missing:
sudo apt-get install mono wine
Under out/make/squirell.Windows/x64
, you will find the app-1.0.0 Setup.exe
installer file, which we were able to install on Windows 10 without any problems.
Listing 3 displays the configuration object [11] from the package.json
file as a portal. Lines 2 to 13 contain the package formats to be generated in the make_targets
sub-object, listed by operating system.
Listing 3
Configuration of forge
01 [...] 02 "forge": { 03 "make_targets": { 04 "win32": [ 05 "squirrel" 06 ], 07 "darwin": [ 08 "zip" 09 ], 10 "linux": [ 11 "deb", 12 "rpm" 13 ] 14 }, 15 "electronPackagerConfig": { 16 "packageManager": "yarn" 17 }, 18 "electronWinstallerConfig": { 19 "name": "app" 20 }, 21 "electronInstallerDebian": {}, 22 "electronInstallerRedhat": {}, 23 "github_repository": { 24 "owner": "", 25 "name": "" 26 }, 27 "windowsStoreConfig": { 28 "packageName": "", 29 "name": "app" 30 } 31 } 32 [...]
Conclusions
Electron makes it easy to create desktop apps using popular web technologies such as HTML, CSS, and JavaScript. At the same time, Electron offers an infrastructure that can port apps to other systems via the command line.
Compared to Cordova Phone Gap [12], the installation is trivial, even if support for mobile operating systems such as Android or iOS is currently missing. If you want to be on the safe side, simply pack on the target system each time and test the app immediately.
Infos
- Electron: https://electronjs.org
- Chromium: https://www.chromium.org
- Node.js: https://nodejs.org
- Bootstrap: https://getbootstrap.com
- React: https://reactjs.org
- Angular: https://angular.io
- JQuery: https://jquery.com
- Yarn: https://yarnpkg.com
electron-forge
: https://github.com/electron-userland/electron-forge- Boilerplate projects: https://github.com/sindresorhus/awesome-electron#boilerplates
- Configuration of
electron-forge
: https://github.com/electron-userland/electron-forge#config - Phone Gap: https://phonegap.com
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
![Learn More](https://www.linux-magazine.com/var/linux_magazin/storage/images/media/linux-magazine-eng-us/images/misc/learn-more/834592-1-eng-US/Learn-More_medium.png)
News
-
NVIDIA Released Driver for Upcoming NVIDIA 560 GPU for Linux
Not only has NVIDIA released the driver for its upcoming CPU series, it's the first release that defaults to using open-source GPU kernel modules.
-
OpenMandriva Lx 24.07 Released
If you’re into rolling release Linux distributions, OpenMandriva ROME has a new snapshot with a new kernel.
-
Kernel 6.10 Available for General Usage
Linus Torvalds has released the 6.10 kernel and it includes significant performance increases for Intel Core hybrid systems and more.
-
TUXEDO Computers Releases InfinityBook Pro 14 Gen9 Laptop
Sporting either AMD or Intel CPUs, the TUXEDO InfinityBook Pro 14 is an extremely compact, lightweight, sturdy powerhouse.
-
Google Extends Support for Linux Kernels Used for Android
Because the LTS Linux kernel releases are so important to Android, Google has decided to extend the support period beyond that offered by the kernel development team.
-
Linux Mint 22 Stable Delayed
If you're anxious about getting your hands on the stable release of Linux Mint 22, it looks as if you're going to have to wait a bit longer.
-
Nitrux 3.5.1 Available for Install
The latest version of the immutable, systemd-free distribution includes an updated kernel and NVIDIA driver.
-
Debian 12.6 Released with Plenty of Bug Fixes and Updates
The sixth update to Debian "Bookworm" is all about security mitigations and making adjustments for some "serious problems."
-
Canonical Offers 12-Year LTS for Open Source Docker Images
Canonical is expanding its LTS offering to reach beyond the DEB packages with a new distro-less Docker image.
-
Plasma Desktop 6.1 Released with Several Enhancements
If you're a fan of Plasma Desktop, you should be excited about this new point release.