Electron package guidelines
Using the system electron
Arch Linux provides globaland packages that can be used to run an electron application via a shellscript wrapper:
#!/bin/sh exec electron /path/to/appname/ "$@"
appname/ directory, or alternatively a file bundle called
appname.asar, can be found in a prebuilt electron application as the
resources/app/ folder (or
resources/app.asar). Everything else is just a copy of the electron runtime and can be removed from the final package.
Building compiled extensions against the system electron
Some electron applications have compiled native extensions which link to the electron runtime, and must be built using the correct electron version. Since npm/yarn will always build against a private prebuilt copy of electron, patch the electron dependency from
package.json to reference the same version as the system electron dependency. The build system will download the prebuilt copy it requires, compile the native extensions, and package everything into a final distribution, but this can be pruned during the
package() step as usual.
Alternatively, you can remove the electron dependency from
package.json and set the correct environment variables before running npm:
export npm_config_target=$(cat /usr/lib/electron/version | tail -c +2) export npm_config_arch=x64 export npm_config_target_arch=x64 export npm_config_disturl=https://atom.io/download/electron export npm_config_runtime=electron export npm_config_build_from_source=true HOME="$srcdir/.electron-gyp" npm install
HOME to a path inside the
$srcdir so the build process doesn't place any files in your real
HOME directory. Make sure to adjust the path for all further commands that make use of the
(more details here).
An Electron package that contains compiled native extensions is architecture-dependent. Otherwise it is most likely architecture-independent.
If the package contains a prebuilt copy of electron, it is always architecture-dependent.
If the package is architecture-dependent, install the
resources/app/ directory to
/usr/lib/appname/. Otherwise use
If the package contains a prebuilt copy of electron, copy the final distribution in its entirety to