I’ve been following the view.docs.flatpak.org/en/latest/electron.html to build an Electron app as a Flatpak, but I’m running into some issues during the build process. The dependencies aren’t being resolved correctly, and the app fails to launch after installation .
Here’s the setup I’m using for the Flatpak manifest:
id: org.flathub.electron-sample-app
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
base: org.electronjs.Electron2.BaseApp
base-version: '23.08'
sdk-extensions:
- org.freedesktop.Sdk.Extension.node18
command: run.sh
finish-args:
- --socket=x11
- --socket=pulseaudio
- --share=network
The build process works up until the point where it installs the NPM dependencies. Here’s the command I’m using:
$ flatpak-builder build org.flathub.electron-sample-app.yml --install-deps-from=flathub --force-clean --user --install
But when I run the app with:
$ flatpak run org.flathub.electron-sample-app
It doesn’t start, and the terminal shows no errors. I’ve double-checked that the dependencies are correctly listed in the package.json
file and that the node extension is installed, but the app just won’t launch.
Has anyone faced this issue when building Electron apps as Flatpaks? I’ve also tried setting the npm_config_cache
and using --offline mode
for the build, but the dependencies still seem to be causing issues.
Any help or advice would be appreciated!