electron-builder: NSIS build fails

Not sure if it’s already supposed to be buildable, in any case here is the output:

Building one-click NSIS installer using nsis 3.0rc1
Command line defined: "PRODUCT_NAME=My App"
Command line defined: "APP_ID=com.app.my"
Command line defined: "APP_DESCRIPTION=My App Client Software"
Command line defined: "APP_BUILD_DIR=/Users/kunkinkan/Desktop/app/dist/win-unpacked"
Command line defined: "VERSION=1.5.1"
Command line defined: "MUI_ICON=/Users/kunkinkan/Desktop/app/build/icon.ico"
Command line defined: "MUI_UNICON=/Users/kunkinkan/Desktop/app/build/icon.ico"
Command line defined: "COMPANY_NAME=app Foundation"
Command line defined: "APP_EXECUTABLE_FILENAME=My App.exe"
Command line defined: "UNINSTALL_FILENAME=Uninstall My App.exe"
Command line defined: "MULTIUSER_INSTALLMODE_INSTDIR=85125e2a-0211-5c49-9018-9358da1074b1"
Command line defined: "MULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1"
Command line defined: "MULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1"
Command line defined: "MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME=UninstallString"
Command line defined: "MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME=InstallLocation"
Command line defined: "MULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER"
Command line defined: "MULTIUSER_INSTALLMODE_ALLOW_ELEVATION"
Command line defined: "ONE_CLICK"
Processing config: /Users/kunkinkan/.cache/nsis/nsis-3.0rc1/nsisconf.nsh
Processing script file: "/Users/kunkinkan/Desktop/app/node_modules/electron-builder/templates/nsis/installer.nsi" (UTF8)

Unhandled rejection Error: libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

Error: Command failed: /Users/kunkinkan/.cache/nsis/nsis-3.0rc1/osx/makensis -DPRODUCT_NAME=My App -DAPP_ID=com.app.my -DAPP_DESCRIPTION=My App Client Software -DAPP_BUILD_DIR=/Users/kunkinkan/Desktop/app/dist/win-unpacked -DVERSION=1.5.1 -DMUI_ICON=/Users/kunkinkan/Desktop/app/build/icon.ico -DMUI_UNICON=/Users/kunkinkan/Desktop/app/build/icon.ico -DCOMPANY_NAME=app Foundation -DAPP_EXECUTABLE_FILENAME=My App.exe -DUNINSTALL_FILENAME=Uninstall My App.exe -DMULTIUSER_INSTALLMODE_INSTDIR=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME=UninstallString -DMULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME=InstallLocation -DMULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER -DMULTIUSER_INSTALLMODE_ALLOW_ELEVATION -DONE_CLICK -XFileBufSize 64 -XName "My App" -XOutFile "/Users/kunkinkan/Desktop/app/dist/My App Setup 1.5.1.exe" -XUnicode true -XSetCompressor /SOLID lzma -XSetCompressorDictSize 64 -XAutoCloseWindow true /Users/kunkinkan/Desktop/app/node_modules/electron-builder/templates/nsis/installer.nsi
libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

    at /Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/util.ts:91:18
    at ChildProcess.exithandler (child_process.js:209:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)
From previous event:
    at Object.exec (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/util.ts:78:9)
    at NsisTarget.<anonymous> (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/targets/nsis.ts:121:15)
    at undefined.next (native)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)
From previous event:
    at tsAwaiter (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/awaiter.ts:10:47)
    at Object.build (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/builder.ts:182:52)
    at Object.<anonymous> (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/build-cli.ts:8:28)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:449:3

Building one-click NSIS installer using nsis 3.0rc1
Error: libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

Error: Command failed: /Users/kunkinkan/.cache/nsis/nsis-3.0rc1/osx/makensis -DPRODUCT_NAME=My App -DAPP_ID=com.app.my -DAPP_DESCRIPTION=My App Client Software -DAPP_BUILD_DIR=/Users/kunkinkan/Desktop/app/dist/win-unpacked -DVERSION=1.5.1 -DMUI_ICON=/Users/kunkinkan/Desktop/app/build/icon.ico -DMUI_UNICON=/Users/kunkinkan/Desktop/app/build/icon.ico -DCOMPANY_NAME=app Foundation -DAPP_EXECUTABLE_FILENAME=My App.exe -DUNINSTALL_FILENAME=Uninstall My App.exe -DMULTIUSER_INSTALLMODE_INSTDIR=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_INSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_UNINSTALL_REGISTRY_KEY=85125e2a-0211-5c49-9018-9358da1074b1 -DMULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME=UninstallString -DMULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME=InstallLocation -DMULTIUSER_INSTALLMODE_DEFAULT_CURRENTUSER -DMULTIUSER_INSTALLMODE_ALLOW_ELEVATION -DONE_CLICK -XFileBufSize 64 -XName "My App" -XOutFile "/Users/kunkinkan/Desktop/app/dist/My App Setup 1.5.1.exe" -XUnicode true -XSetCompressor /SOLID lzma -XSetCompressorDictSize 64 -XAutoCloseWindow true /Users/kunkinkan/Desktop/app/node_modules/electron-builder/templates/nsis/installer.nsi
libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

    at /Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/util.ts:91:18
    at ChildProcess.exithandler (child_process.js:209:5)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:850:16)
    at Socket.<anonymous> (internal/child_process.js:323:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:492:12)
From previous event:
    at Object.exec (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/util.ts:78:9)
    at NsisTarget.<anonymous> (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/targets/nsis.ts:121:15)
    at undefined.next (native)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)
From previous event:
    at tsAwaiter (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/awaiter.ts:10:47)
    at Object.build (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/builder.ts:182:52)
    at Object.<anonymous> (/Users/kunkinkan/Desktop/app/node_modules/electron-builder/src/build-cli.ts:8:28)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Function.Module.runMain (module.js:575:10)
    at startup (node.js:160:18)
    at node.js:449:3

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 36 (20 by maintainers)

Most upvoted comments

So I finally figured out what the issue was. It was caused by encoding.

https://sourceforge.net/p/nsis/bugs/1165/

Modyfing the generated script which is piped into stdin to state Unicode false, works.

I also discovered the reason why it worked in SSH-ing into the builder server vs Jenkins.

When SSH-ing into the builder server and typing locale.

LANG="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_ALL=

When making Jenkins run locale.

LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

So the solution for me was to change the environment variables within Jenkins to match the ones which exist when SSH-ing.

Apparently this is a well known issue http://unix.stackexchange.com/questions/164779/jenkins-does-not-use-systems-locales