How to make exe files from a node.js app? How to make exe files from a node.js app? windows windows

How to make exe files from a node.js app?


The solution I've used is Roger Wang's node-webkit.

This is a fantastic way to package nodejs apps and distribute them, it even gives you the option to "bundle" the whole app as a single executable. It supports windows, mac and linux.

Here are some docs on the various options for deploying node-webkit apps, but in a nutshell, you do the following:

  1. Zip up all your files, with a package.json in the root
  2. Change the extension from .zip to .nw
  3. copy /b nw.exe+app.nw app.exe

Just as an added note - I've shipped several production box/install cd applications using this, and it's worked great. Same app runs on windows, mac, linux and over the web.

Update: the project name has changed to 'nw.js' and is properly located here: nw.js


There a few alternatives, both free and commercial. I haven't used any of them but in theory they should work:

Most will require you to keep the batch file as main executable, and then bundle node.exe and your scripts.

Depending on your script, you also have the option to port it to JSDB, which supports an easy way to create executables by simply appending resources to it.

A third quasi-solution is to keep node somewhere like C:\utils and add this folder to your PATH environment variable. Then you can create .bat files in that dir that run node + your preferred scripts - I got coffeescript's coffee working on windows this way. This setup can be automated with a batch file, vb script or installer.


For anyone stumbling upon this question, there are now two projects that create exes out of your node projects, Pkg and Electron.atom.io, they differ slightly:

  1. Pkg will compile your project to native code, they also include assets AND a NodeJS installation (the system won't need to install NodeJS to run the executable). Your source code will not be included. The resulting executable is Windows ONLY ( .exe ). All platforms are supported now.It now requires a licence for commercial products. Fully open source.
  2. Electron.atom.io while it will not compact and generate an executable for you, it CAN be used to distribute NodeJS apps since they offer a way to distribute applications. The benefits are that electron is multi-platform (Windows, macOS, Linux), the cons are that your source code WILL be included, even though they offer a way to distribute your app inside an asar archive. It will not be bulletproof but it's still better than your source in plain.