Electron-Builder无法为Windows

时间:2017-12-27 19:14:54

标签: mono electron electron-builder squirrel.windows

我无法使用Electron-Builder和Squirrel为测试应用程序构建更新。我认为Wine没有找到7z.exe文件的问题。以下是我认为是主要问题的错误的一部分:

Utility: Failed to extract file /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.0-full.nupkg to /Users/<user>/.local/share/SquirrelTemp/tempa
wine: cannot find L"C:\\windows\\system32\\.7z.exe"

我尝试安装7-Zip x64和x86。我甚至尝试在c:/ windows / system32 /.

中安装它

在macOS上构建Windows。

的package.json

{
  "name": "electronquickstart",
  "version": "1.0.1",
  "description": "A minimal Electron application",
  "main": "./app/main.js",
  "scripts": {
    "start": "electron .",
    "dist": "build -w --x64"
  },
  "repository": "",
  "keywords": [
    "Electron",
    "quick",
    "start",
    "tutorial",
    "demo"
  ],
  "author": "GitHub",
  "license": "CC0-1.0",
  "devDependencies": {
    "electron": "~1.7.8",
    "electron-builder": "^19.49.2",
    "electron-builder-squirrel-windows": "^19.49.0"
  },
  "build": {
    "appId": "com.domain.test",
    "copyright": "Copyright © 2017 Company",
    "productName": "Teste",
    "electronVersion": "1.7.8",
    "win": {
      "target": [
        "squirrel"
      ],
      "certificateFile": "./certificate/certificate.pfx",
      "certificatePassword": "password00",
      "icon": "./build/icon.ico"
    },
    "squirrelWindows": {
      "remoteReleases": "http://example.com/installer/",
      "iconUrl": "http://example.com/favicon.ico",
      "useAppIdAsId": false
    }
  },
  "dependencies": {
  }
}

完整日志:

Error: Exit code: 255. Command failed: mono /Users/<user>/Library/Caches/electron-builder/Squirrel.Windows/Squirrel.Windows-1.7.8/Update-Mono.exe --releasify /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.1-full.nupkg --releaseDir /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows
2017-12-27 16:45:21> Utility: Failed to extract file /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.0-full.nupkg to /Users/<user>/.local/share/SquirrelTemp/tempa
wine: cannot find L"C:\\windows\\system32\\.7z.exe"
2017-12-27 16:45:21> Unhandled exception: System.AggregateException: One or more errors occurred. ---> System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <6e9b92f0d119424382ef180639777acb>:0 
  at Squirrel.DeltaPackageBuilder.CreateDeltaPackage (Squirrel.ReleasePackage basePackage, Squirrel.ReleasePackage newPackage, System.String outputFile) [0x000e9] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.ReleasifyElectron (System.String package, System.String targetDir, System.String baseUrl) [0x00110] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x004c4] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x00097] in <6dfa1b8045584e6384eb68e7d588f716>:0 
---> (Inner Exception #0) System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 <---

System.AggregateException: One or more errors occurred. ---> System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <6e9b92f0d119424382ef180639777acb>:0 
  at Squirrel.DeltaPackageBuilder.CreateDeltaPackage (Squirrel.ReleasePackage basePackage, Squirrel.ReleasePackage newPackage, System.String outputFile) [0x000e9] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.ReleasifyElectron (System.String package, System.String targetDir, System.String baseUrl) [0x00110] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x004c4] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x000bb] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.Main (System.String[] args) [0x00006] in <6dfa1b8045584e6384eb68e7d588f716>:0 
---> (Inner Exception #0) System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 <---


2017-12-27 16:45:13> Program: Starting Squirrel Updater: --releasify /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.1-full.nupkg --releaseDir /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows
2017-12-27 16:45:14> DeltaPackageBuilder: Extracting /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.0-full.nupkg and /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.1-full.nupkg into /Users/<user>/.local/share/SquirrelTemp/tempb

2017-12-27 16:45:21> Utility: Failed to extract file /Users/<user>/developer/electron-examples/installer-and-auto-update/dist/squirrel-windows/electronquickstart-1.0.0-full.nupkg to /Users/<user>/.local/share/SquirrelTemp/tempa
wine: cannot find L"C:\\windows\\system32\\.7z.exe"
2017-12-27 16:45:21> Unhandled exception: System.AggregateException: One or more errors occurred. ---> System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <6e9b92f0d119424382ef180639777acb>:0 
  at Squirrel.DeltaPackageBuilder.CreateDeltaPackage (Squirrel.ReleasePackage basePackage, Squirrel.ReleasePackage newPackage, System.String outputFile) [0x000e9] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.ReleasifyElectron (System.String package, System.String targetDir, System.String baseUrl) [0x00110] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x004c4] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x00097] in <6dfa1b8045584e6384eb68e7d588f716>:0 
---> (Inner Exception #0) System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 <---

System.AggregateException: One or more errors occurred. ---> System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in <6e9b92f0d119424382ef180639777acb>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <6e9b92f0d119424382ef180639777acb>:0 
  at Squirrel.DeltaPackageBuilder.CreateDeltaPackage (Squirrel.ReleasePackage basePackage, Squirrel.ReleasePackage newPackage, System.String outputFile) [0x000e9] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.ReleasifyElectron (System.String package, System.String targetDir, System.String baseUrl) [0x00110] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x004c4] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.main (System.String[] args) [0x000bb] in <6dfa1b8045584e6384eb68e7d588f716>:0 
  at Squirrel.Update.Program.Main (System.String[] args) [0x00006] in <6dfa1b8045584e6384eb68e7d588f716>:0 
---> (Inner Exception #0) System.Exception: wine: cannot find L"C:\\windows\\system32\\.7z.exe"
  at Squirrel.Utility+<ExtractZipToDirectory>d__22.MoveNext () [0x000ff] in <6dfa1b8045584e6384eb68e7d588f716>:0 <---


    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/builder-util/src/util.ts:109:16
    at ChildProcess.exithandler (child_process.js:279:5)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
From previous event:
    at exec (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/builder-util/src/util.ts:77:3)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/src/squirrelPack.ts:109:24
    at Generator.next (<anonymous>)
From previous event:
    at SquirrelBuilder.releasify (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/out/squirrelPack.js:277:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/src/squirrelPack.ts:88:16
From previous event:
    at SquirrelBuilder.buildInstaller (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/out/squirrelPack.js:258:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts:35:27
    at Generator.next (<anonymous>)
From previous event:
    at SquirrelWindowsTarget.build (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js:82:11)
    at taskManager.addTask.default.map.it (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/platformPackager.ts:120:85)
From previous event:
    at WinPackager.packageInDistributableFormat (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/platformPackager.ts:120:41)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/platformPackager.ts:116:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
    at WinPackager.pack (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/out/platformPackager.js:195:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/packager.ts:345:24
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:167:5)
From previous event:
    at Packager.doBuild (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/out/packager.js:407:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/packager.ts:289:52
From previous event:
    at Packager._build (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/out/packager.js:351:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/src/packager.ts:259:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
    at Packager.build (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder-lib/out/packager.js:311:11)
    at /Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/src/builder.ts:287:40
    at Generator.next (<anonymous>)
From previous event:
    at _build (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/out/builder.js:61:21)
    at build (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/src/builder.ts:257:10)
    at then (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/src/cli/cli.ts:49:4)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
From previous event:
    at Object.args [as handler] (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/src/cli/cli.ts:49:4)
    at Object.runCommand (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/yargs/lib/command.js:228:22)
    at Object.parseArgs [as _parseArgs] (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/yargs/yargs.js:1041:24)
    at Object.get [as argv] (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/yargs/yargs.js:957:21)
    at Object.<anonymous> (/Users/<user>/developer/electron-examples/installer-and-auto-update/node_modules/electron-builder/src/cli/cli.ts:43:15)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:613:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

1 个答案:

答案 0 :(得分:0)

我花了很多时间调试此问题...

我觉得Squirell和电子造粒机制作不佳

我们可以通过将7z.exe处理为~/.cache/electron-builder/Squirrel.Windows/Squirrel.Windows-1.7.8/(在Linux上)来解决此问题

Update-Mono.exe从那里启动,因此它能够找到7z.exe

UPD:对于Mac OS dir,应为/Users/<user>/Library/Caches/electron-builder/Squirrel.Windows/Squirrel.Windows-1.7.8/Update-Mono.exe