Flatpak for WordPress Studio – handling npm install and Electron build

Sep 7, 2025
A

I’m planning to create a Flatpak package for the WordPress Studio project. This won’t be an official package, but while working on it I ran into a few issues that I couldn’t resolve by searching or reading the documentation.

My main problem is that the project requires installing npm packages (node_modules) and then running a build step (some commands to generate the Electron package). Currently, WordPress Studio doesn’t provide Linux builds, but my plan is to generate an unofficial build and make it available on Flathub. The part I’m stuck on is how to handle this installation/build process in the Flatpak context for the NPM Packages.

The documentation says:

By default, flatpak-builder doesn’t allow build tools to access the network. This means that tools which rely on downloading sources will not work. Therefore, Node.js packages must be downloaded prior to running the build. Setting the electron_config_cache environment variable means that these will be found when it
comes to the build.

So running npm install and building inside the Flatpak sandbox isn’t an option.

My current plan is to fork the project and add a GitHub Action that generates the build artifacts in advance. Then, I pull the artifact link from flatpak-builder, so I only need to download and copy the built files (via install commands) into the Flatpak.

Does this sound like a viable approach? Are there any references to similar cases that I could look at?

R

Look at GitHub - flatpak/flatpak-builder-tools: Various helper tools for flatpak-builder for npm/yarn handling. I don’t think we have any electron apps, that are build from source. They usually repackage some deb/rpm binary. Those obviously already have the npm/yarn stuff baked in.