electron / forge

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

Problem generating executables using electron-forge with VueJS #3479

Open tiaggofg opened 9 months ago

tiaggofg commented 9 months ago

Pre-flight checklist

Electron Forge version

7.2.0

Electron version

28.2.0

Operating system

Ubuntu 22.04

Last known working Electron Forge version

No response

Expected behavior

The expected behavior is that executables should be built for Windows, macOS, and Linux platforms.

Actual behavior

The following error when running npm run make in Electron-Forge to generate executables for my desktop application developed with VueJS.

An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 1
Output:
Attempting to build package from 'my_vue_app.nuspec'.
File not found: 'my-vue-app.exe'.

Steps to reproduce

Create a project using Electron-Forge + VueJS as per the documentation provided at: https://www.electronforge.io/guides/framework-integration/vue-3.

After setting up the project, execute the command npm run make to build the Windows image from a Linux environment (Ubuntu 22.04).

Additional information

The full log of npm run make execution

➜ npm run make          

> my-vue-app@1.0.0 make
> electron-forge make

✔ Checking your system
✔ Loading configuration
✔ Loading configuration
✔ Resolving make targets
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: , , , 
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: , , , 
❯ Running package command
  ✔ Preparing to package application
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: , , , 
❯ Running package command
  ✔ Preparing to package application
✔ Loading configuration
✔ Resolving make targets
  › Making for the following targets: , , , 
✔ Running package command
  ✔ Preparing to package application
  ✔ Running packaging hooks
    ✔ Running generateAssets hook
    ✔ Running prePackage hook
      ✔ [plugin-vite] Building vite bundles
  ✔ Packaging application
    ✔ Packaging for x64 on linux [1s]
  ✔ Running postPackage hook
✔ Running preMake hook
❯ Making distributables
  ✖ Making a squirrel distributable for linux/x64
    › Failed with exit code: 1
      Output:
      Attempting to build package from 'my_vue_app.nuspec'.
      File not found: 'my-vue-app.exe'.
  ✖ Making a zip distributable for linux/x64
  ✖ Making a deb distributable for linux/x64
  ✖ Making a rpm distributable for linux/x64
◼ Running postMake hook

An unhandled rejection has occurred inside Forge:
Error: Failed with exit code: 1
Output:
Attempting to build package from 'my_vue_app.nuspec'.
File not found: 'my-vue-app.exe'.
at ChildProcess.<anonymous> (/var/lib/sentynela/workspace/sentynela/my-vue-app/node_modules/electron-winstaller/lib/spawn-promise.js:49:24)
    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)

My configuration from forge.config.js:

module.exports = {
  packagerConfig: {}, 
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {},
      platforms: [ 'win64', 'linux']
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin', 'linux', 'win32', 'win64'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {},
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
  plugins: [
    {
      name: '@electron-forge/plugin-vite',
      config: {
        // `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.js',
            config: 'vite.main.config.mjs',
          },
          {
            entry: 'src/preload.js',
            config: 'vite.preload.config.mjs',
          },
        ],
        renderer: [
          {
            name: 'main_window',
            config: 'vite.renderer.config.mjs',
          },
        ],
      },
    },
  ],
};

And my package.json

{
  "name": "my-vue-app",
  "productName": "my-vue-app",
  "version": "1.0.0",
  "description": "Client desktop with vue",
  "main": ".vite/build/main.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish"
  },
  "keywords": [],
  "author": "Tiago",
  "license": "MIT",
  "devDependencies": {
    "@electron-forge/cli": "^7.2.0",
    "@electron-forge/maker-deb": "^7.2.0",
    "@electron-forge/maker-rpm": "^7.2.0",
    "@electron-forge/maker-squirrel": "^7.2.0",
    "@electron-forge/maker-zip": "^7.2.0",
    "@electron-forge/plugin-auto-unpack-natives": "^7.2.0",
    "@electron-forge/plugin-vite": "^7.2.0",
    "@vitejs/plugin-vue": "^5.0.3",
    "electron": "28.2.0"
  },
  "dependencies": {
    "buefy": "github:buefy/buefy#buefy-next",
    "electron-squirrel-startup": "^1.0.0",
    "vue": "^3.4.15"
  }
}

Wine64 version: wine-6.0.3 (Ubuntu 6.0.3~repack-1)

Mono version: Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:37:50 UTC 2023) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com

captainIT commented 7 months ago

you can try with this template