electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.7k stars 1.74k forks source link

Always fails when pack and sign on windows #7952

Open iotzy opened 11 months ago

iotzy commented 11 months ago

I always get the following error when I run pack command using gitlab runner


log when using gitlab runner

$ yarn.cmd run pack:w
  • electron-builder  version=23.6.0 os=10.0.22621
  • loaded configuration  file=D:\runner\builds\3QTSQDVec\0\fastone\data-manager\electron-builder.json
  • packaging       platform=win32 arch=x64 electron=26.4.3 appOutDir=release\win-unpacked
  • signing         file=release\win-unpacked\resources\keypair.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\rclone.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
after build; disable sandbox
  • signing         file=release\win-unpacked\data-manager.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\x64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\ia32\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\arm64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • building        target=zip arch=x64 file=release\data-manager-win-23.12.186423.zip
  • packaging       platform=win32 arch=ia32 electron=26.4.3 appOutDir=release\win-ia32-unpacked
  • signing         file=release\win-ia32-unpacked\resources\keypair.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-ia32-unpacked\resources\rclone.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
after build; disable sandbox
  • signing         file=release\win-ia32-unpacked\data-manager.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-ia32-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\x64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-ia32-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\ia32\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-ia32-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\arm64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • building        target=zip arch=ia32 file=release\data-manager-win-23.12.186423.zip
  • building        target=nsis file=release\data-manager-win-23.12.186423.exe archs=x64, ia32 oneClick=false perMachine=false
  • building        target=portable file=release\data-manager-win-23.12.186423.exe archs=x64, ia32
  • signing         file=release\win-ia32-unpacked\resources\elevate.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\elevate.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\data-manager-win-23.12.[186](https://git.fastonetech.com:8443/fastone/data-manager/-/jobs/1184452#L186)423.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  •   Signing NSIS uninstaller  file=release\__uninstaller-nsis-data-manager.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\data-manager-win-23.12.186423.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • building block map  blockMapFile=release\data-manager-win-23.12.186423.exe.blockmap
  ⨯ Exit code: 1. Command failed: D:\runner\builds\3QTSQDVec\0\fastone\data-manager\node_modules\app-builder-lib\node_modules\7zip-bin\win\x64\7za.exe a -bd -mx=7 -mtc=off -mm=Deflate -mcu D:\runner\builds\3QTSQDVec\0\fastone\data-manager\release\data-manager-win-23.12.186423.zip .
WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe
7-Zip (a) 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive:
17 folders, 91 files, 398612850 bytes (381 MiB)
Creating archive: D:\runner\builds\3QTSQDVec\0\fastone\data-manager\release\data-manager-win-23.12.186423.zip
Add new data to archive: 17 folders, 91 files, 398612850 bytes (381 MiB)
Files read from disk: 91
Archive size: 133604360 bytes (128 MiB)
WARNINGS for files:
.\resources\elevate.exe : ��һ����������ʹ�ô��ļ��������޷����ʡ�
----------------
WARNING: Cannot open 1 file
WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe
  failedTask=build stackTrace=Error: Exit code: 1. Command failed: D:\runner\builds\3QTSQDVec\0\fastone\data-manager\node_modules\app-builder-lib\node_modules\7zip-bin\win\x64\7za.exe a -bd -mx=7 -mtc=off -mm=Deflate -mcu D:\runner\builds\3QTSQDVec\0\fastone\data-manager\release\data-manager-win-23.12.186423.zip .
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   7-Zip (a) 19.00 (x64) : Copyright (c) [199](https://git.fastonetech.com:8443/fastone/data-manager/-/jobs/1184452#L199)9-2018 Igor Pavlov : 2019-02-21
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Scanning the drive:
17 folders, 91 files, 398612850 bytes (381 MiB)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Creating archive: D:\runner\builds\3QTSQDVec\0\fastone\data-manager\release\data-manager-win-23.12.186423.zip
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Add new data to archive: 17 folders, 91 files, 398612850 bytes (381 MiB)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Files read from disk: 91
Archive size: 133604360 bytes (128 MiB)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   WARNINGS for files:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   .\resources\elevate.exe : ��һ����������ʹ�ô��ļ��������޷����ʡ�
----------------
WARNING: Cannot open 1 file
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       at D:\runner\builds\3QTSQDVec\0\fastone\data-manager\node_modules\builder-util\src\util.ts:133:18
    at ChildProcess.exithandler (node:child_process:404:5)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
---------------------------------------------------------------

log when running on the local pc


$ yarn run pack:w
  • electron-builder  version=23.6.0 os=10.0.22621
  • loaded configuration  file=D:\workspace\fs-repo\data-manager\electron-builder.json
  • writing effective config  file=release\builder-effective-config.yaml
  • packaging       platform=win32 arch=x64 electron=26.4.3 appOutDir=release\win-unpacked
  • signing         file=release\win-unpacked\resources\keypair.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\rclone.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx

  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\x64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\ia32\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\win-unpacked\resources\app.asar.unpacked\node_modules\7zip-bin\win\arm64\7za.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • building        target=zip arch=x64 file=release\data-manager-win-0.0.0-PLACEHOLDER.zip
  • building        target=nsis file=release\data-manager-win-0.0.0-PLACEHOLDER.exe archs=x64 oneClick=false perMachine=false
  • building        target=portable file=release\data-manager-win-0.0.0-PLACEHOLDER.exe archs=x64

  • signing         file=release\win-unpacked\resources\elevate.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  • signing         file=release\data-manager-win-0.0.0-PLACEHOLDER.exe certificateFile=./lib/sh-fastone-info-tech-co.pfx
  ⨯ Cannot cleanup: 

Error #1 --------------------------------------------------------------------------------
Error: Exit code: 1. Command failed: D:\workspace\fs-repo\data-manager\node_modules\app-builder-lib\node_modules\7zip-bin\win\x64\7za.exe a -bd -mx=7 -mtc=off -mm=Deflate -mcu D:\workspace\fs-repo\data-manager\release\data-manager-win-0.0.0-PLACEHOLDER.zip .

WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe

7-Zip (a) 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive:
17 folders, 91 files, 431416702 bytes (412 MiB)

Creating archive: D:\workspace\fs-repo\data-manager\release\data-manager-win-0.0.0-PLACEHOLDER.zip

Add new data to archive: 17 folders, 91 files, 431416702 bytes (412 MiB)

Files read from disk: 91
Archive size: 140725050 bytes (135 MiB)

WARNINGS for files:

.\resources\elevate.exe : ��һ����������ʹ�ô��ļ��������޷����ʡ�
----------------
WARNING: Cannot open 1 file

WARNING: ��һ����������ʹ�ô��ļ��������޷����ʡ�
.\resources\elevate.exe

    at D:\workspace\fs-repo\data-manager\node_modules\builder-util\src\util.ts:133:18
    at ChildProcess.exithandler (node:child_process:404:5)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

Error #2 --------------------------------------------------------------------------------
Error: C:\Users\DELL\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
Output:
Command line defined: "APP_ID=com.fastonetech.data-manager"
Command line defined: "APP_GUID=60d90fcc-de00-5bfe-9562-bfe0a0809251"
Command line defined: "UNINSTALL_APP_KEY=60d90fcc-de00-5bfe-9562-bfe0a0809251"
Command line defined: "PRODUCT_NAME=data-manager"
Command line defined: "PRODUCT_FILENAME=data-manager"
Command line defined: "APP_FILENAME=data-manager"
Command line defined: "APP_DESCRIPTION=A full-featured download manager"
Command line defined: "VERSION=0.0.0-PLACEHOLDER"
Command line defined: "PROJECT_DIR=D:\workspace\fs-repo\data-manager"
Command line defined: "BUILD_RESOURCES_DIR=D:\workspace\fs-repo\data-manager\build"
Command line defined: "APP_PACKAGE_NAME=data-manager"
Command line defined: "MUI_ICON=D:\workspace\fs-repo\data-manager\public\icons\win.ico"
Command line defined: "MUI_UNICON=D:\workspace\fs-repo\data-manager\public\icons\win_uninstall.ico"
Command line defined: "APP_64=D:\workspace\fs-repo\data-manager\release\data-manager-0.0.0-PLACEHOLDER-x64.nsis.7z"
Command line defined: "APP_64_NAME=data-manager-0.0.0-PLACEHOLDER-x64.nsis.7z"
Command line defined: "APP_64_HASH=F8B5C023C08D12FD56B6B39EDCA1C151719221DD24593797E8B391CBBA406F7444F407F54D558FA9623A2E7F8EBE47B7EF980DDAE06F383D2CA8E4454C281079"
Command line defined: "COMPANY_NAME=fastone"
Command line defined: "APP_INSTALLER_STORE_FILE=data-manager-updater\installer.exe"
Command line defined: "COMPRESSION_METHOD=7z"
Command line defined: "INSTALL_MODE_PER_ALL_USERS_REQUIRED"
Command line defined: "allowToChangeInstallationDirectory"
Command line defined: "SHORTCUT_NAME=data-manager"
Command line defined: "DELETE_APP_DATA_ON_UNINSTALL"
Command line defined: "UNINSTALL_DISPLAY_NAME=data-manager"
Command line defined: "MUI_WELCOMEFINISHPAGE_BITMAP=${NSISDIR}\Contrib\Graphics\Wizard\nsis3-metro.bmp"
Command line defined: "MUI_UNWELCOMEFINISHPAGE_BITMAP=${NSISDIR}\Contrib\Graphics\Wizard\nsis3-metro.bmp"
Command line defined: "UNINSTALLER_ICON=D:\workspace\fs-repo\data-manager\public\icons\win_uninstall.ico"
Command line defined: "ESTIMATED_SIZE=421328"
Command line defined: "COMPRESS=auto"
Command line defined: "BUILD_UNINSTALLER"
Command line defined: "UNINSTALLER_OUT_FILE=D:\workspace\fs-repo\data-manager\release\__uninstaller-nsis-data-manager.exe"
Processing config: C:\Users\DELL\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\nsisconf.nsh
Processing script file: "<stdin>" (UTF8)

Processed 1 file, 10 command line commands, writing output (x86-unicode):

Output: "D:\workspace\fs-repo\data-manager\release\data-manager-win-0.0.0-PLACEHOLDER.exe"

Error output:
Can't open output file
Error - aborting creation process

    at ChildProcess.<anonymous> (D:\workspace\fs-repo\data-manager\node_modules\builder-util\src\util.ts:250:14)
    at Object.onceWrapper (node:events:510:26)
    at ChildProcess.emit (node:events:390:28)
    at ChildProcess.cp.emit (D:\workspace\fs-repo\data-manager\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)  failedTask=build stackTrace=Error: Cannot cleanup:
iotzy commented 11 months ago

{ "win": {
    "sign": null,
    "verifyUpdateCodeSignature": false,
    "icon": "./public/icons/win.ico",
    "artifactName": "${name}-win-${version}.${ext}",
    "target": [
      {
        "target": "nsis",
        "arch": ["x64"]
      },
      {
        "target": "zip",
        "arch": ["x64"]
      },
      {
        "target": "portable",
        "arch": ["x64"]
      }
    ],
    "requestedExecutionLevel": "highestAvailable",
    "extraResources": {
      "from": "./lib/win32/",
      "to": "./"
    },
    "certificateFile": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.pfx",
    "certificatePassword": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  },
  "nsis": {
    "oneClick": false,
    "allowElevation": false,
    "perMachine": false,
    "packElevateHelper": false,
    "createDesktopShortcut": true,
    "createStartMenuShortcut": true,
    "allowToChangeInstallationDirectory": true,
    "deleteAppDataOnUninstall": true,
    "runAfterFinish": true,
    "installerIcon": "./public/icons/win.ico",
    "uninstallDisplayName": "${name}",
    "uninstallerIcon": "./public/icons/win_uninstall.ico",
    "installerHeaderIcon": "./public/icons/win.ico"
  }
}
github-actions[bot] commented 9 months ago

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.