electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Problem when `name` in `package.json` includes `@` (monorepos)

Open Stanzilla opened this issue 1 year ago • 4 comments

  • Electron-Builder Version: 24.13.3
  • Node Version: 20
  • Electron Version: 29.3.1
  • Electron Type (current, beta, nightly): current
  • Target: x86_64-unknown-linux

When your package has a name like @repo/electron, the command passed to fpm does not handle that correctly as you can see here: /home/cobalt/actions-runner/_work/wago-app/wago-app/apps/electron/public/icon.png=/usr/share/icons/hicolor/0x0/apps/@wago-appelectron.png ' during an RPM build on Linux

Full logs:

⨯ cannot execute  cause=exit status 1
                    out={:timestamp=>"2024-06-05T15:09:33.773639+0000", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"x86_64-unknown-linux\", \"--define\", \"buildroot /tmp/package-rpm-build-46f3215fd322e0895710ff85d04ce4f11c65299fd78d548b186b3e1e2c3a/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-46f3215fd322e0895710ff85d04ce4f11c65299fd78d548b186b3e1e2c3a\", \"--define\", \"_sourcedir /tmp/package-rpm-build-46f3215fd322e0895710ff85d04ce4f11c65299fd78d548b186b3e1e2c3a\", \"--define\", \"_rpmdir /tmp/package-rpm-build-46f3215fd322e0895710ff85d04ce4f11c65299fd78d548b186b3e1e2c3a/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-46f3215fd322e0895710ff85d04ce4f11c65299fd78d548b186b3e1e2c3a/SPECS/Wago App.spec\"]", :level=>:error}
    
                    command=/home/cobalt/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t rpm -d gtk3 -d libnotify -d nss -d libXScrnSaver -d libXtst -d xdg-utils -d at-spi2-core -d libuuid --rpm-os linux --rpm-compression xzmt --architecture amd64 --after-install /tmp/t-4SfopK/0-after-install --after-remove /tmp/t-4SfopK/1-after-remove --description 'The Wago App is your all-in-one solution to download and update your addons and WeakAuras. ' --version 2.0.0 --package /home/cobalt/actions-runner/_work/wago-app/wago-app/apps/electron/release/2.0.0/WagoApp_2.0.0.rpm --name 'Wago App' --maintainer 'The Wago Dev Team <[email protected]>' --url https://addons.wago.io/ --vendor 'The Wago Dev Team <[email protected]>' --license 'All Rights Reserved' '/home/cobalt/actions-runner/_work/wago-app/wago-app/apps/electron/release/2.0.0/linux-unpacked/=/opt/Wago App' /home/cobalt/actions-runner/_work/wago-app/wago-app/apps/electron/public/icon.png=/usr/share/icons/hicolor/0x0/apps/@wago-appelectron.png '/tmp/t-4SfopK/2-Wago App.desktop=/usr/share/applications/@wago-appelectron.desktop'
                    workingDir=
 ELIFECYCLE  Command failed with exit code 1.
Error:  command finished with error: command (/home/cobalt/actions-runner/_work/wago-app/wago-app/apps/electron) /usr/local/bin/pnpm run build exited (1)

Stanzilla avatar Jun 05 '24 15:06 Stanzilla

Hmmm that seems like it may be a limitation with fpm binary? Is there a way to sanitize the input to fix this command?

mmaietta avatar Jun 07 '24 20:06 mmaietta

I don't know, I assumed it is what gets passed to fpm needs/should be sanitized by electron-builder before?

Stanzilla avatar Jun 07 '24 21:06 Stanzilla

The simplest solution I have found is to add this to your build config

extraMetadata: {
	name: "simple-app-name",
},

Even if you get RPM to behave you will run into issues with your persistent data store, updates etc etc. It is better to just override your package name to what you want your app name to be

Another approach I have seen is

packageName: "simple-app-name",

But this only affects the binary and setup names. The data in ~/.config and %appdata% still uses your package's scope

KaoSDlanor avatar Jul 17 '24 13:07 KaoSDlanor

The simplest solution I have found is to add this to your build config

extraMetadata: {
	name: "simple-app-name",
},

Even if you get RPM to behave you will run into issues with your persistent data store, updates etc etc. It is better to just override your package name to what you want your app name to be

Another approach I have seen is

packageName: "simple-app-name",

But this only affects the binary and setup names. The data in ~/.config and %appdata% still uses your package's scope

you saved my day!

MarkShawn2020 avatar Aug 25 '24 08:08 MarkShawn2020

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Oct 25 '24 00:10 github-actions[bot]

not stale

Stanzilla avatar Oct 25 '24 00:10 Stanzilla

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Dec 25 '24 00:12 github-actions[bot]

not stale

Stanzilla avatar Dec 25 '24 03:12 Stanzilla

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Apr 04 '25 00:04 github-actions[bot]

nop

Stanzilla avatar Apr 04 '25 00:04 Stanzilla

@Stanzilla this is a limitation with fpm and per this comment, @ shouldn't be supported due to OS-level requirements.

Even if you get RPM to behave you will run into issues with your persistent data store, updates etc etc. It is better to just override your package name to what you want your app name to be

mmaietta avatar Apr 04 '25 00:04 mmaietta