Vite React TS - Ubuntu .deb: make command fails "Error: could not find the Electron app binary"
Pre-flight checklist
- [x] I have read the contribution documentation for this project.
- [x] I agree to follow the code of conduct that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.5.0
Electron version
v33.0.2
Operating system
Ubuntu 20.04.6 LTS
Last known working Electron Forge version
No response
Expected behavior
build should work
Actual behavior
not working
Steps to reproduce
- set name
shutdown-schedulerin package.json - set product name
Shutdown Schedulerin package.json - run make command on ubuntu
- error happens
An unhandled rejection has occurred inside Forge:
Error: could not find the Electron app binary at "/home/user/Desktop/my-timer-app/out/Shutdown Scheduler-linux-x64/shutdown-scheduler". You may need to re-bundle the app using Electron Packager's "executableName" option.
at /home/user/Desktop/my-timer-app/node_modules/electron-installer-common/src/installer.js:154:15
at async Promise.all (index 3)
at async module.exports (/home/user/Desktop/my-timer-app/node_modules/electron-installer-debian/src/installer.js:261:3)
at async MakerDeb.make (/home/user/Desktop/my-timer-app/node_modules/@electron-forge/maker-deb/src/MakerDeb.ts:41:30)
at async /home/user/Desktop/my-timer-app/node_modules/@electron-forge/core/src/api/make.ts:280:41
at async _Task.taskFn (/home/user/Desktop/my-timer-app/node_modules/@electron-forge/tracer/src/index.ts:51:14)
at async _Task.run (/home/user/Desktop/my-timer-app/node_modules/listr2/dist/index.cjs:2063:11)
error Command failed with exit code 1.
from my obersvations, on macOS the generated binary is called Shutdown Scheduler and make works fine, but on ubuntu, the binary is called Shutdown Scheduler but make seems to be looking for shutdown-scheduler instead.
it seems the issue is fixed when i set executableName: "shutdown-scheduler" in forge packagerConfig but i don't understand why this error only happens on ubuntu.
Additional information
package.json
{
"name": "shutdown-scheduler",
"productName": "Shutdown Scheduler",
"version": "1.0.0",
"description": "Schedule Shutdowns like a Pro",
"main": ".vite/build/main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx ."
},
"devDependencies": {
"@electron-forge/cli": "^7.5.0",
"@electron-forge/maker-deb": "^7.5.0",
"@electron-forge/maker-rpm": "^7.5.0",
"@electron-forge/maker-squirrel": "^7.5.0",
"@electron-forge/maker-zip": "^7.5.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.5.0",
"@electron-forge/plugin-fuses": "^7.5.0",
"@electron-forge/plugin-vite": "^7.5.0",
"@electron/fuses": "^1.8.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"electron": "33.0.2",
"eslint": "^8.0.1",
"eslint-plugin-import": "^2.25.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"ts-node": "^10.0.0",
"typescript": "~4.5.4",
"vite": "^5.0.12"
},
"keywords": [],
"author": {
"name": "Hichem Fantar",
"email": "[email protected]"
},
"license": "MIT",
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72",
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"electron-squirrel-startup": "^1.0.1",
"lucide-react": "^0.454.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-use": "^17.5.1",
"tailwind-merge": "^2.5.4",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss-animate": "^1.0.7"
}
}
forge.config.ts
import type { ForgeConfig } from "@electron-forge/shared-types";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { MakerZIP } from "@electron-forge/maker-zip";
import { MakerDeb } from "@electron-forge/maker-deb";
// import { MakerRpm } from "@electron-forge/maker-rpm";
import { VitePlugin } from "@electron-forge/plugin-vite";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
const config: ForgeConfig = {
packagerConfig: {
asar: false,
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ["darwin"]),
// new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
// If you are familiar with Vite configuration, it will look really familiar.
build: [
{
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: "src/main.ts",
config: "vite.main.config.ts",
target: "main",
},
{
entry: "src/preload.ts",
config: "vite.preload.config.ts",
target: "preload",
},
],
renderer: [
{
name: "main_window",
config: "vite.renderer.config.ts",
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: false,
}),
],
};
export default config;
Similar boat, also from the Vite TS template with React added to it.
From what I can tell, there's something wrong with how the name value from package.json is used in the build process with the Vite TS template and MakerDeb. The raw executable is built successfully, but the process errors when trying to create the installer due to the name mismatch described by the error in this issue.
Here's what works:
- Using
nameinpackage.jsonon its own, but do NOT use NPM-style naming (e.g. no@groupname/projectnameas the build step will treat that as a directory path to a file, not a file only). - Same as above plus an
executableNamein theforge.config.tsfile'spackagerConfigobject. Thenameinpackage.jsonandexecutableNameinpackagerConfigmust have identical values.- If you do this, you can then also use
productNameto give the app a nice professional user-facing name too.
- If you do this, you can then also use
While you can still set values into the config of MakerDeb, bin is ignored. Documentation is sparse but I assumed that bin was the platform-specific version of executableName, so it's weird to me that it's not used. Using productName in the MakerDeb config or the package.json file allows that property to work, though the installer and executable name will not match it. Shows up in the software menu, at least.
Maybe this is all working as intended - I can clearly build with the right specific mix of values in place - but if so, then documentation needs improvement. Especially for MakerDebConfig, which has no way to view its options other than digging into source code. Kinda defeats the point of having a documentation website at that stage.
Normal, intuitive work led to the same errors that this issue is about. Workarounds exist, at least.
@AlexStormwood have you encountered this issue https://github.com/electron/forge/issues/3759 ?
@AlexStormwood have you encountered this issue #3759 ?
Responded in the referenced post, seems unrelated to this issue.
this is the repo related to this issue https://github.com/hichemfantar/ShutdownScheduler