electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.49k stars 516 forks source link

Electron-forge flatpak maker exits with status code 1 #1792

Closed trusktr closed 4 years ago

trusktr commented 4 years ago

When I try to run electron-forge make with @electron-forge/maker-flatpak, it fails with an error:

An unhandled error has occurred inside Forge:
An error occured while making for target: flatpak
flatpak failed with status code 1
Error: flatpak failed with status code 1
    at ChildProcess.<anonymous> (/home/trusktr/src/foo+bar/node_modules/@malept/flatpak-bundler/index.js:71:16)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:485:12)
    at maybeClose (internal/child_process.js:1051:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

This is my electron-forge config:

module.exports = {
  packagerConfig: {},
  makers: [ {name: '@electron-forge/maker-flatpak'} ],
}

Any ideas?

EDIT: I suppose I would need to debug the flatpak-bundler code on that line 71. cc @malept. Have you had any exit code 1 with flatpak?

malept commented 4 years ago

(For the record, this is not an enhancement.)

This should be fixed in 6.0.0-beta.52 (#1703). If upgrading Forge doesn't work, I need more information via setting the DEBUG environment variable to electron-installer-flatpak,@malept/flatpak-bundler and posting the output here (preferably via a gist or <details> element)

linonetwo commented 2 years ago

Same here 

    {
      name: '@electron-forge/maker-flatpak',
      config: {
        options: {
          categories: ['Productivity'],
        },
      },
    },
 ✖ Making for target: flatpak - On platform: linux - For arch: x64

        An unhandled error has occurred inside Forge:
        An error occured while making for target: flatpak
        flatpak failed with status code 1
        Error: flatpak failed with status code 1
            at ChildProcess.<anonymous> (/home/runner/work/TidGi-Desktop/TidGi-Desktop/node_modules/@malept/flatpak-bundler/index.js:71:16)
            at ChildProcess.emit (events.js:400:28)
            at ChildProcess.emit (domain.js:475:12)
            at maybeClose (internal/child_process.js:1058:16)
            at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)

with no helpful error message.

felipecrs commented 7 months ago

DEBUG doesn't help:

❯ DEBUG=1 npm run make

> clipboard-sync@0.13.0 make
> electron-vite build && electron-forge make

renderer and preload config is missing
vite v5.2.8 building SSR bundle for production...
✓ 4 modules transformed.
dist/main/index.js  28.82 kB
✓ built in 126ms
✔ Checking your system
[STARTED] Loading configuration
[SUCCESS] Loading configuration
[STARTED] Resolving make targets
[DATA] Making for the following targets:
[SUCCESS] Resolving make targets
[STARTED] Running package command
[STARTED] Preparing to package application
[SUCCESS] Preparing to package application
[STARTED] Running packaging hooks
[STARTED] Running generateAssets hook
[SUCCESS] Running generateAssets hook
[STARTED] Running prePackage hook
[SUCCESS] Running prePackage hook
[SUCCESS] Running packaging hooks
[STARTED] Packaging application
[DATA] Determining targets...
[STARTED] Packaging for x64 on linux
[STARTED] Copying files
[SUCCESS] Copying files
[STARTED] Preparing native dependencies
[TITLE] Preparing native dependencies
[SUCCESS] Preparing native dependencies
[STARTED] Finalizing package
[SUCCESS] Finalizing package
[SUCCESS] Packaging for x64 on linux
[SUCCESS] Packaging application
[STARTED] Running postPackage hook
[SUCCESS] Running postPackage hook
[SUCCESS] Running package command
[STARTED] Running preMake hook
[SUCCESS] Running preMake hook
[STARTED] Making distributables
[STARTED] Making a flatpak distributable for linux/x64
[FAILED] flatpak failed with status code 1
[FAILED] flatpak failed with status code 1

An unhandled rejection has occurred inside Forge:
Error: flatpak failed with status code 1
at ChildProcess.<anonymous> (/home/felipecrs/repos/clipboard-sync/node_modules/@malept/flatpak-bundler/index.js:71:16)
    at ChildProcess.emit (node:events:518:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
felipecrs commented 7 months ago

Tweaking the code a bit I found out it's failing when running:

flatpak install --user --no-deps --arch x86_64 --assumeyes runtime/org.freedesktop.Platform/x86_64/19.08

Running the command on my own:

Looking for matches…
error: No remote refs found similar to ‘runtime/org.freedesktop.Platform/x86_64/19.08’

The issue was resolved by running:

flatpak --user remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Note the --user. Now maker-flatpak works fine.

You may also need:

git config --global protocol.file.allow always

PS: I'm on Ubuntu 22.04 on WSL2.

bennyzen commented 1 month ago

Unfortunately, the above provided fix does not work on Arch or Manjaro. Any further ideas/suggestions?

linonetwo commented 1 month ago

Why closed