forge icon indicating copy to clipboard operation
forge copied to clipboard

electron-forge make produces exit code 1 while building all supported windows distributables

Open RareScrap opened this issue 1 year ago • 0 comments

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.4.0

Electron version

v32.0.2

Operating system

Microsoft Windows 11 Pro N (10.0.22621 N/A Build 22621)

Last known working Electron Forge version

No response

Expected behavior

The application was successfully built for all supported Windows platforms (ia32, x64, arm64). The resulting files are identical to the files produced by running scripts make:windows:x86, make:windows:x64, make:windows:arm64 one by one.

Actual behavior

The make:windows script terminates with error code 1. No distributable Windows files were created.

The expected behavior can be achieved by executing commands npm run make:windows:x86, npm run make:windows:x64, npm run make:windows:arm64 in turn.

Steps to reproduce

  1. Init an Electron project using the webpack-typescript template:
    npm init electron-app@latest my-new-app -- --template=webpack-typescript
    
  2. Install dependencies:
    npm ci
    
  3. Add these scripts to project.json to make platform specific distributables:
    {
     // ...
      "scripts": {
        // ...
        "make": "electron-forge make",
        "make:windows": "npm run make -- --arch=all --platform=win32",
        "make:windows:x86": "npm run make -- --arch=ia32 --platform=win32",
        "make:windows:x64": "npm run make -- --arch=x64 --platform=win32",
        "make:windows:arm64": "npm run make -- --arch=arm64 --platform=win32",
        // ...
      },
      // ...
    }
    
  4. Run npm run make:windows or npm run make -- --arch=all --platform=win32 directly

Additional information

Console output as is
 *  Executing task: npm run make:windows 


> [email protected] make:windows
> npm run make -- --arch=all --platform=win32


> [email protected] make
> electron-forge make --arch=all --platform=win32

✔ Checking your system
✔ 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-webpack] Preparing webpack bundles
        ✔ Preparing native dependencies [1s]
        ✔ Building webpack bundles [5s]
  ❯ Packaging application
    › Determining targets...
    ❯ Packaging for ia32 on win32
      ⠧ Copying files
      ⠧ Preparing native dependencies
      ⠧ Finalizing package
    ❯ Packaging for x64 on win32
      ✔ Copying files
      ⠧ Preparing native dependencies
      ⠧ Finalizing package
    ❯ Packaging for arm64 on win32
      ⠧ Copying files
      ⠧ Preparing native dependencies
      ⠧ Finalizing package
  ◼ Running postPackage hook
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run make:windows" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.
Console output with DEBUG=electron-forge:*
PS C:\Users\user\my-new-app> $env:DEBUG="electron-forge:*"
PS C:\Users\user\my-new-app> npm run make:windows 

> [email protected] make:windows
> npm run make -- --arch=all --platform=win32


> [email protected] make
> electron-forge make --arch=all --platform=win32

✔ Checking your system

electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms
❯ Loading configuration
  electron-forge:project-resolver searching for project in: C:\Users\user\my-new-app +0ms
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\user\my-new-app\package.json +3ms
  electron-forge:plugin:webpack hooking process events +0ms
✔ Loading configuration
❯ Resolving make targets
› Making for the following targets: 
✔ Resolving make targets
❯ Running package command
❯ Preparing to package application
  electron-forge:project-resolver searching for project in: C:\Users\user\my-new-app +2s
  electron-forge:project-resolver package.json with forge dependency found in C:\Users\user\my-new-app\package.json +3ms
  electron-forge:plugin:webpack hooking process events +13ms
✔ Preparing to package application
❯ Running packaging hooks
❯ Running generateAssets hook
✔ Running generateAssets hook
❯ Running prePackage hook
❯ [plugin-webpack] Preparing webpack bundles
❯ Preparing native dependencies for all
✔ Preparing native dependencies
❯ Building webpack bundles
  electron-forge:plugin:webpack:webpackconfig Config mode: production +0ms
✔ Building webpack bundles
✔ [plugin-webpack] Preparing webpack bundles
✔ Running prePackage hook
✔ Running packaging hooks
❯ Packaging application
› Determining targets...
  electron-forge:packager packaging with options {
  asar: { unpack: '{**/*.node,**/*.node}' },
  overwrite: true,
  ignore: [Function (anonymous)],
  quiet: true,
  dir: 'C:\\Users\\user\\my-new-app',
  arch: 'all',
  platform: 'win32',
  afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ],
  afterComplete: [ [AsyncFunction (anonymous)] ],
  afterCopy: [ [AsyncFunction (anonymous)] ],
  afterExtract: [ [AsyncFunction (anonymous)] ],
  afterPrune: [ [AsyncFunction (anonymous)] ],
  out: 'C:\\Users\\user\\my-new-app\\out',
  electronVersion: '32.0.2'
} +0ms
  electron-forge:packager targets: [
  { platform: 'win32', arch: 'ia32' },
  { platform: 'win32', arch: 'x64' },
  { platform: 'win32', arch: 'arm64' }
] +10ms
❯ Packaging for ia32 on win32
❯ Packaging for x64 on win32
❯ Packaging for arm64 on win32
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
❯ Copying files
❯ Preparing native dependencies
❯ Finalizing package
✔ Copying files

An unhandled rejection has occurred inside Forge:
Error: ENOENT: no such file or directory, lstat 'C:\Users\user\AppData\Local\Temp\electron-packager\tmp-356G3s\resources\app\.webpack\x64'

  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +11s
  electron-forge:plugin:webpack handling process exit with: { cleanup: true } +1ms

The app project source code that reproduces the error

RareScrap avatar Sep 07 '24 01:09 RareScrap