I have a node app that I wrote, that I run as follows:
node.exe app.js inputArg
Is there some way I can package this into a .exe by itself? So I can just do something like this?
I have some way of faking this by using a batch file, so I can do this:
But this requires that I have all the dependencies and node in that folder, which is not ideal.
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.
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.
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:
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.