Currently there doesn’t seem to be many options for distributing a binary standalone of a Node.js application.
One of them, and practically unique, option is the Nexe. Does just what you want, but there are some (big) problems:
- It can be a bit unstable (your code is very simple).
- Does not support native modules.
- Does not support Windows.
Despite all the cons... let’s go to one hello world:
1. Installing the Nexe:
$ sudo npm install -g nexe
2. Creating a test file:
$ echo "console.log('Hello World');" > hello.js
3. Compiling the application:
$ nexe -i hello.js -o hello
making application bundle with /home/talles/hello.js
writing application bundle:
[a partir daqui vêm uma saída 'pesada' do compilador]
-i
, of input, are the input files; -o
, of output, the output file. There is also -t
temporary directory and -r
of Runtime (version of the number to be used).
4. Ready, the final file is generated:
$ ./hello
Hello World
In the example the generated final file had a size of 11Mb.
Take a look at this link: http://stackoverflow.com/questions/8173232/make-exe-files-from-node-js-app. Apparently there are some tools for this job.
– Marcelo de Aguiar
I think the best option would be to create a program using electron
– Fernando Moura