Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite React TS - Ubuntu .deb: make command fails "Error: could not find the Electron app binary" #3753

Open
3 tasks done
hichemfantar opened this issue Nov 9, 2024 · 0 comments

Comments

@hichemfantar
Copy link

hichemfantar commented Nov 9, 2024

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • 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-scheduler in package.json
  • set product name Shutdown Scheduler in 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;
@hichemfantar hichemfantar changed the title Vite React TS - Ubuntu .deb build: name and productName are not used correctly during packaging Vite React TS - Ubuntu .deb: make command fails "Error: could not find the Electron app binary" Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants