Package node.js application to a standalone executable and pack it into a msi installer.
Package node.js application to a standalone executable and pack it into a msi installer (Windows only).
This module will:
Note it does not require any third-software pre-installed (binaries of the installer, i.e. wixtoolset, will be locally downloaded in the package installation folder from its official repository).
As this module introduces constraints to both target os and arch (respectively win32 and x64), install it globally, as an optional dependency or launch it using npx to avoid to constrain your module with these settings.
npm i wix-msi -g
wix-msi target_bin
where target_bin is a bin entry of the package.json
The Product unique identifier assigned to this installer/application. It could be set using the -U/—uuid flag.
Note once assigned, it should note be changed in order to be able to perform update.
If not provided, it will be automatically generated and serialized in a file named .wixrc.
Executable of the node application is set by default with the target bin entry of the package.json.
It could be changed using the -e/—exe flag to any name.
![]() |
![]() |
---|---|
The screenshots above show the UI with default settings.
Customization of the installer UI could be performed using the following options:
![]() |
![]() |
---|---|
The screenshots above show the installation result in both application menu and application panel.
Customization of the installation could be performed using the following options:
Windows Application Menu
Windows Application Panel
option | desc | value | default |
---|---|---|---|
-d / —dir | build folder | path(*) | ./build |
-U / —uuid | product unique identifier | uuid | automatically generated if not provided (and saved in wixrc file) |
-e / —exe | modify the executable name | string | package.bin[target_bin] |
-f / —files | use the ‘files’ entry of package.json to get sources (see here) | boolean | false |
-l / —license | include license panel in msi installer (Done if a LICENSE or LICENSE.md file is found) | boolean | true |
-H / —homepage | URL of the shortcut added to menu directory (not added if undefined) | URL | package.homepage |
-a / —author | provider of the package | string | package.author |
-i / —icon | icon displayed in Windows application panel (.ico or png file). Note png file will be automatically resized to a 256x256 image | path(*) | assets/icon.png from this module |
-b / —banner | image used on the right of the top banner of installer panels (a 90x48 png/jpg image). Note it will be automatically resized to expected size keeping its ratio as best | path(*) | assets/banner.png from this module |
-B / —background | left image displayed in the introduction panel (a 493x176 png/jpg image). Note it will be automatically resized to expected size | path(*) | assets/background.png from this module |
-c / —color | background color of panels | css color | ‘white’ |
-s / —save | save settings in .wixrc file | boolean | n.a. |
(*) path must be relative from the execution directory.
A .wixrc file could be use to store options:
{
"target-bin": {
"uuid": "12345678-90ab-cdef-1234-567890abcde",
"icon": "./myIcon.png"
}
}
Using the -s/—save option will generated it if the validation of user’s settings succeed.
Packaging the application in a standalone executable is done via the pkg module.
By default, mapping of the required files/deps is done via the ‘bin’ property of the package.json and then found via the calls done to ‘require’ but:
const m = require(variable) // Not supported
import a from 'a' // Not supported
For such case, the -f/—files option has been introduced in order to use the ‘files’ property of the package.json to perform this task.
Note, in this case, all files matching with the glob patterns of this property will be included and not only the required ones as for default case.
While it’s still in beta, version will follow v0.Y.Z format, where:
This module is MIT licensed. See LICENSE.