Electron-builder: Problem signing Update.exe

Created on 24 Oct 2016  路  3Comments  路  Source: electron-userland/electron-builder

  • Version: 7.14.2

  • Target: --win --x64

I'm having a lot of trouble getting a consistent build of my application on Windows 10. Sometimes it works but more often than not it fails signing
C:UsersAidanAppDataLocalTempelectron-builder-eUnlC6t-29dc-0-Update.exe
because it's in use in another process.

I haven't found any pattern in my thrashing around that makes it work. The file doesn't exist in the files system at the end. It looks like some sort of race condition!! Or maybe I'm doing something wrong but it isn't obvious to me.

Here is the full output

> [email protected] dist C:\Users\Aidan\Documents\GitHub\StEdsElectron
> build --win --x64

Skip app dependencies rebuild because dev and app dependencies are not separated
Packaging for platform win32 x64 using electron 1.4.4 to dist\win-unpacked

Signing StEdsBookings.exe (certificate file "C:\Temp\SelfSignedCert.pfx")
node_modules\7zip is not packed into asar archive - contains executable code
Building squirrel x64 installer

Signing t-29dc-0-Update.exe (certificate file "C:\Temp\SelfSignedCert.pfx")
Error: Exit code: 1. Command failed: C:\Users\Aidan\.cache\winCodeSign\winCodeSign-1.4.2\windows-10\signtool.exe sign /t http://timestamp.verisign.com/scripts/timstamp.dll /f C:\Temp\SelfSignedCert.pfx /d StEdsBookings /du https://github.com/AidanNichol/StEdsElectron /p a1dan! C:\Users\Aidan\AppData\Local\Temp\electron-builder-eUnlC6\t-29dc-0-Update.exe
SignTool Error: The file is being used by another process.
SignTool Error: An error occurred while attempting to sign: C:\Users\Aidan\AppData\Local\Temp\electron-builder-eUnlC6\t-29dc-0-Update.exe

Done Adding Additional Store

Number of errors: 1

SignTool Error: The file is being used by another process.
SignTool Error: An error occurred while attempting to sign: C:\Users\Aidan\AppData\Local\Temp\electron-builder-eUnlC6\t-29dc-0-Update.exe

    at C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\util\util.ts:102:16
    at ChildProcess.exithandler (child_process.js:213:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
From previous event:
    at Object.exec (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\util\util.ts:80:3)
    at C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\windowsCodeSign.ts:117:20
    at next (native)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at tsAwaiter (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\util\awaiter.ts:10:47)
    at WinPackager.sign (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\out\winPackager.js:98:16)
    at bluebird_1.Promise.all.fs_extra_p_1.copy.then (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\targets\squirrelPack.ts:59:28)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at Object.<anonymous> (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\targets\squirrelPack.ts:59:8)
From previous event:
    at tsAwaiter (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\src\util\awaiter.ts:10:47)
    at Object.build (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\out\builder.js:138:12)
    at Object.<anonymous> (C:\Users\Aidan\Documents\GitHub\StEdsElectron\node_modules\electron-builder\out\build-cli.js:23:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Most helpful comment

I've figured out what the problem was. Being on Windows I was using File Explorer to see the results of the build. It would appear that if I left File Explorer open on the dist directory it cause some file (at least on Windows 10) to "be in use by another process". Making sure that File Explorer is looking elsewhere seems to fix the problem!!

All 3 comments

Is it possible for you to use nsis target? build.win.target to nsis?

I've just tried that and the first time I ran it I got

Signing StEdsBookings Setup 0.1.1.exe (certificate file "C:\Temp\SelfSignedCert.pfx")
Error: Exit code: 1. Command failed: C:\Users\Aidan\.cache\winCodeSign\winCodeSign-1.4.2\windows-10\signtool.exe sign /t http://timestamp.verisign.com/scripts/timstamp.dll /f C:\Temp\SelfSignedCert.pfx /d StEdsBookings /du https://github.com/AidanNichol/StEdsElectron /p a1dan! C:\Users\Aidan\Documents\GitHub\StEdsElectron\dist\StEdsBookings Setup 0.1.1.exe
SignTool Error: The specified timestamp server either could not be reached or returned an invalid response.
SignTool Error: An error occurred while attempting to sign: C:\Users\Aidan\Documents\GitHub\StEdsElectron\dist\StEdsBookings Setup 0.1.1.exe

but it worked on my second and subsequent attempts so that maybe an intermitent network problem. I was using squirrel because Iwould like to get automatic updates and the readme says that isn't there yet for NSIS. It says it will be there this month - if that's true then I can wait.

I've figured out what the problem was. Being on Windows I was using File Explorer to see the results of the build. It would appear that if I left File Explorer open on the dist directory it cause some file (at least on Windows 10) to "be in use by another process". Making sure that File Explorer is looking elsewhere seems to fix the problem!!

Was this page helpful?
0 / 5 - 0 ratings