Electron-builder: SignTool error: NSIS installer EXE is being used by another process

Created on 22 Nov 2016  路  9Comments  路  Source: electron-userland/electron-builder

  • Version: 9.1.0

  • Target: Windows/NSIS (32 and 64-bit)

SignTool successfully signs almost all of the binaries (both 32 and 64-bit unpacked, as well as the uninstaller) using the certificate specified by CSC_LINK and CSC_KEY_PASSWORD, but fails to sign the final installer EXE.

Not sure if the presence of two very similar copies of the SignTool error messages indicate that two concurrent calls were made, or if that's just the error being re-displayed.

Error message/stack trace:

> @ prebuild D:\Mosaic\Chroma-prebuilt
> gulp build --env=development

[12:18:13] Using gulpfile D:\Mosaic\Chroma-prebuilt\gulpfile.js
[12:18:13] Starting 'bundle'...
[12:18:13] Finished 'bundle' after 117 渭s
[12:18:13] Starting 'less'...
[12:18:13] Finished 'less' after 19 渭s
[12:18:13] Starting 'environment'...
[12:18:13] Finished 'environment' after 11 ms
[12:18:13] Starting 'build'...
[12:18:13] Finished 'build' after 3.62 渭s

> @ build D:\Mosaic\Chroma-prebuilt
> build --x64 --ia32 --publish never

Rebuilding native production dependencies for arch x64
Packaging for win32 x64 using electron 1.4.7 to dist\win-unpacked
Signing Chroma.exe (certificate file "<path_to_cert>")
Packaging NSIS installer for arch x64
Rebuilding native production dependencies for arch ia32
Packaging for win32 ia32 using electron 1.4.7 to dist\win-ia32-unpacked
Signing Chroma.exe (certificate file "<path_to_cert>")
Packaging NSIS installer for arch ia32
Building NSIS installer
Signing t-1b68-0-uninstaller.exe (certificate file "<path_to_cert>")
Signing Chroma Setup 1.2.1.exe (certificate file "<path_to_cert>")
Error: Exit code: 1. Command failed: C:\Users\Bobby\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.4.2\windows-10\signtool.exe sign /tr http://timestamp.comodoca.com/rfc3161 /f <cert_hash> (sha256 hash) /fd sha256 /td sha256 /d Chroma /du https://gitlab.com/mosaic-mfg/palette-standalone#readme /as /p <cert_pass> D:\Mosaic\Chroma-prebuilt\dist\Chroma Setup 1.2.1.exe
SignTool Error: The file is being used by another process.
SignTool Error: An error occurred while attempting to sign: D:\Mosaic\Chroma-prebuilt\dist\Chroma Setup 1.2.1.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: D:\Mosaic\Chroma-prebuilt\dist\Chroma Setup 1.2.1.exe

    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\util\util.ts:66: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 Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
From previous event:
    at exec (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\util\util.ts:44:3)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\windowsCodeSign.ts:115:16
From previous event:
    at spawnSign (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\windowsCodeSign.js:94:22)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\windowsCodeSign.ts:48:11
From previous event:
    at sign (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\windowsCodeSign.js:42:21)
    at WinPackager.doSign (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\winPackager.ts:141:12)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\winPackager.ts:125:16
From previous event:
    at WinPackager.sign (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\winPackager.js:198:11)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\targets\nsis.ts:216:20
    at next (native)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)
From previous event:
    at NsisTarget.buildInstaller (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\targets\nsis.js:296:11)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\targets\nsis.ts:76:18
    at next (native)
From previous event:
    at NsisTarget.finishBuild (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\targets\nsis.js:151:11)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\packager.ts:136:31
From previous event:
    at Packager.doBuild (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\packager.js:256:11)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\packager.ts:100:38
    at next (native)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)
From previous event:
    at Packager.build (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\packager.js:208:11)
    at D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\src\builder.ts:240:40
    at next (native)
From previous event:
    at build (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\builder.js:89:21)
    at Object.<anonymous> (D:\Mosaic\Chroma-prebuilt\node_modules\electron-builder\out\build-cli.js:62:41)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! @ build: `build --x64 --ia32 --publish never`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the @ build script 'build --x64 --ia32 --publish never'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build --x64 --ia32 --publish never
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Mosaic\Chroma-prebuilt\npm-debug.log
backlog help wanted investigate windows

Most helpful comment

I get this error quite a bit actually. Usually has to do with Window Defender. Disabling it usually takes care of it.

Ernie

All 9 comments

After manually cleaning out dist all signing processes worked fine鈥攕eems like this may have something to do with artifacts being left in dist

I get this error quite a bit actually. Usually has to do with Window Defender. Disabling it usually takes care of it.

Ernie

i want to sign my windows installer(i have certificate in .p12 format) i know we have to do it by CSC_LINK and CSC_KEY_PASSWORD but not getting any example of how to do it.

please help me out of this!

Thanks in advance.

here is my package.json-
{
"name": "CoDesktopElectron",
"version": "1.0.0",
"description": "CoDesktopElectron",
"homepage": "https://app.onepgr.com/",
"author": "ankur",
"private": true,
scripts": {
"postinstall": "install-app-deps",
"start": "npm install && npm run compile && electron ./app",
"compile": "rimraf app/out && tsc",
"pack": "npm run compile && build --dir",
"dist": "npm run compile && build",
"release": "npm run compile && build"
},
"build": {
"appId": "org.develar.onshape",
"category": "public.app-category.graphics-design",
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 240,
"y": 150,
"type": "link",
"path": "/Applications"
}
]
},
"win": {
"publish": null
},
"linux": {
"publish": null,
"target": [
"deb",
"AppImage"
]
}
},
"devDependencies": {
"asar": "^0.7.2",
"electron": "1.4.3",
"electron-builder": "^7.14.2",
"electron-installer-windows": "^0.2.0",
"electron-prebuilt": "^0.31.0",
"fs-jetpack": "^0.7.0",
"gulp": "^3.9.0",
"gulp-copy": "0.0.2",
"gulp-uglify": "^1.3.0",
"gulp-usemin": "^0.3.12",
"q": "^1.4.1",
"rcedit": "^0.3.0",
"rimraf": "^2.5.4",
"typescript": "^2.0.3"
}
}

@nidhir-systango You need to set these env variables. Please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing

@aesalazar So, disabling Window Defender helps?

Whenever I get this error during signing disabling Defender always seems to clear it.

@develar : Thanks for reply, i have already added CSC_LINK and CSC_KEY_PASSWORD in my windows environment variables bui still my .msi installer(inside dist/win) shows publisher "Unknown".
I am using electron bulder for making installer by command: build -w.
please help me out of this!

@nidhir-systango Please file new issue and attach build log (please set env DEBUG=electron-builder)

I experienced this as well, and the problem was Windows Defender. Excluding my build folder from Windows Defender allowed the signing to succeed.

Was this page helpful?
0 / 5 - 0 ratings