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 |

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
Direct Download
Read full article as PDF:
Price $2.95
News
-
The 14" Pinebook Pro Linux Laptop is Shipping
After a considerable delay, the 14" version of the Pinebook Pro laptop is, once again, available for purchase.
-
OpenMandriva Lx ROME Technical Preview Released
OpenMandriva’s rolling release distribution technical preview has been released for testing purposes and adds some of the latest/greatest software into the mix.
-
Linux Mint 21 is Now Available
The latest iteration of Linux Mint, codenamed Vanessa, has been released with a new upgrade tool and other fantastic features.
-
Firefox Adds Long-Anticipated Feature
Firefox 103 has arrived and it now includes a feature users have long awaited…sort of.
-
System76 Refreshes Their Popular Oryx Pro Laptop with a New CPU
The System76 Oryx Pro laptop has been relaunched with a 12th Gen CPU and more powerful graphics options.
-
Elive Has Released a New Beta
The Elive team is proud to announce the latest beta version (3.8.30) of its Enlightenment-centric Linux distribution.
-
Rocky Linux 9 Has Arrived
The latest iteration of Rocky Linux is now available and includes a host of new features and support for new architecture.
-
Slimbook Executive Linux Ultrabook Upgrading Their CPUs
The Spanish-based company, Slimbook, has made available their next generation Slimbook Executive Linux ultrabooks with a 12th Gen Intel Alder Lake CPU.
-
Fedora Linux is Coming to the Raspberry Pi 4
Thanks to significant work in the upstream, the upcoming release of Fedora 37 will introduce support for the Raspberry Pi 4.
-
New Linux Ultrabook from TUXEDO Computers
TUXEDO Computers has released a new 15" Ultrabook running Linux.