"electron-builder": "^18.1.0"
"electron-updater": "^1.16.0"
I have donated $50 USD as per above.
I have purchased a code signing certificate and converted it to pfx.
My build script is:
"ionic-app-scripts build && set CSC_LINK=C:\Data\Development\Projects\DocsOnTapV2\build\dotv2codesign.pfx && set CSC_KEY_PASSWORD=NotTelling && build"
However I get the following error indicating that it cannot find my pfx file. But the path is valid.
Rebuilding native production dependencies for win32:x64
Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked
Error: C:\Data\Development\Projects\DocsOnTapV2\build\dotv2codesign.pfx doesn't exist
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\codeSign.ts:45:11
at next (native)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
at downloadCertificate (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\codeSign.js:49:21)
at Lazy.WinPackager.cscInfo.Lazy (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:42:9)
at Lazy.get value [as value] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:248:24)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:168:32
at next (native)
I have spent hours trying to find a solution without any success. I did try using keytool to convert the pfx to p12. Made no difference.
My development environment is Windows 10.
Kind regards,
David
Are you sure that your file is accessible (read permission for current user)?
Yes I am - to be sure I just gave full permission to "everyone" and tried again. Still same problem.
Please try 18.2.0 (it is next version, not visible on npm) — is your pfx file inside project directory — please try to set CSC_LINK=build/dotv2codesign.pfx.
I have not tried 18.2.0 yet. But when I change the CSC_LINK as suggested I now get a different error:
`Rebuilding native production dependencies for win32:x64
Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked
Signing Docs On Tap V2.exe (certificate file: "C:\Users\DAVIDC~1AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12")
Error: Exit code: 1. Command failed: C:\Users\DavidComptonAppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.7.0\windows-10\x64\signtool.exe sign /t http://timestamp.verisign.com/scripts/timstamp.dll /f C:\Users\DAVIDC~1AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12 /d Docs On Tap V2 /du http://harboursoftware.com.au/ /p d5661d81d0948092ae1fb308e457d17d446591c320c302347880b6e7edf50f68 (sha256 hash) C:\Data\Development\Projects\DocsOnTapV2\dist\win-unpacked\Docs On Tap V2.exe
SignTool Error: An error occurred while attempting to load the signing
certificate from: C:\Users\DAVIDC~1AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12
SignTool Error: An error occurred while attempting to load the signing
certificate from: C:\Users\DAVIDC~1AppData\Local\Temp\electron-builder-kKmRTN\0-1.p12
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:75: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 exec (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:53:3)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\windowsCodeSign.ts:140:16
at next (native)
at runCallback (timers.js:651:20)
at tryOnImmediate (timers.js:624:5)
at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
at spawnSign (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\windowsCodeSign.js:111:22)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\windowsCodeSign.ts:60:11
at next (native)`
But when I change the CSC_LINK as suggested I now get a different error:
18.2.0 and relative path support was fixed for you. Please try this version.
I can only see 18.1.1 at https://github.com/electron-userland/electron-builder/releases
Release will be announced when published as latest, for now I published 18.2.0 earlier to investigate your issue. Just set version to 18.2.0.
After updating to 18.2.0 - now I get the following error:
Rebuilding native production dependencies for win32:x64
Packaging for win32 x64 using electron 1.6.8 to dist\win-unpacked
TypeError: Path must be a string. Received null
at assertPath (path.js:7:11)
at Object.resolve (path.js:186:7)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\codeSign.ts:46:15
at next (native)
From previous event:
at downloadCertificate (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\codeSign.js:53:21)
at Lazy.WinPackager.cscInfo.Lazy [as creator] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:42:9)
at Lazy.get value [as value] (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder-util\src\util.ts:248:24)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:168:32
at next (native)
From previous event:
at WinPackager.sign (C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\out\winPackager.js:278:11)
at C:\Data\Development\Projects\DocsOnTapV2\node_modules\electron-builder\src\winPackager.ts:253:16
@daveywc Although this ain't seem to be the same issue that you have try to delete the spaces around the && - that was somehow necessary to make it work for me. Part of my package.json:
"release": "set CSC_KEY_PASSWORD=&&set CSC_LINK=%cd%/build/cert/xyz.pfx&&build --ia32",
@black-snow Ouch, it seems your are right, bloody, blooody windows.
@daveywc Please try 18.2.1.
Woot!! We have a winner. No more errors. Thanks @develar and @black-snow. Appreciate all the help!
@black-snow I have added trim to get rid of spaces. Thanks for spotting.
@daveywc Thanks for donation :)
You're welcome ;) Always glad to help develar with this great piece
@develar How's that trim implemented?
// edit: nvm, I'll look at the commit
https://github.com/electron-userland/electron-builder/commit/381e8c0dfd079a1bc6485797789a9da78a51f1e6#diff-adb7b90f249c915a5bdae8ff5be096f4R49
file = path.resolve(currentDir, file.trim())
@develar I think the $50 donation is a small price to pay for all the work that you've put into this. Always happy to contribute.
Most helpful comment
@develar I think the $50 donation is a small price to pay for all the work that you've put into this. Always happy to contribute.