I am trying to convert a node.js file in vscode to an executable file.Is there anyway we can convert it?
Also is there a way we can convert it a mac executable file?
I am trying to convert a node.js file in vscode to an executable file.Is there anyway we can convert it?
Also is there a way we can convert it a mac executable file?
on unixy computers (mac, linux...)
If you put
#! /usr/bin/env node
on the first line of the js file, and then make it executable like this
chmod +x path/to/script.js
you will be able to execute it like this
./path/to/script.js
rather than what you had to do before
node path/to/script.js
so in that sense it will now be an executable file..
and you can probably double click on it too, except it'll close the terminal as soon as it is finished.
You can probably do something very similar on windows.
This doesn't actually bundle node with the file. It depends on node being installed on the system where you run it.
If you want something a little more graphical, take a look at electron maybe; that's work for windows and more unix like platforms.
This will bundle everything you need to run it
Actually, vscode itself is pretty much a node app bundled with electron