-4

I have a JS app that I want to convert to native executable file that can run on any OS by double clicking without any need of downloading and running any script on the terminal.

I am just wondering if this is even possible. If yes can you please tell me how to achieve this functionality?

EDIT: Rephrasing the question as it was having XY Problem associated with it

I have a codebase for my work that requires mysql and redis, there are many parts for FE and BE and I want to start all the necessary services and correct version of node to launch the app with a single click.

So the thing that I want to achieve here is an executable file that can launch mysql, redis, php and my node app sequentially on just a click. Since my colleagues work on different OS I want to create a universal binary that can work on any OS.

Insane_ banda
  • 91
  • 1
  • 6
  • No, that's impossible. You need architecture-specific machine code or an (architecture-specific) interpreter. – jabaa May 29 '22 at 18:01
  • https://www.electronjs.org/ – GrafiCode May 29 '22 at 18:02
  • If this is a web app, you can get halfway there using electron. If this is a node app, rewrite it in a language that can be compiled. Reference: https://stackoverflow.com/questions/8173232/how-to-make-exe-files-from-a-node-js-app – ChrisG May 29 '22 at 18:04
  • @GrafiCode You can't use the same Electron binary on Mac, Linux, Windows and Arduino. – jabaa May 29 '22 at 18:04
  • Also, `I want to convert to native executable file that can run on any OS` is impossible. A native executable by definition only runs on the specific architecture / platform it was compiled for (this is what "native" means) – ChrisG May 29 '22 at 18:05
  • @jabaa that's pretty obvious, of course you have to build different executables, one per architecture. Arduino is not an OS btw. – GrafiCode May 29 '22 at 18:05
  • @ChrisG can you provide me a link to some article which defines "native" in more detailed way? – Insane_ banda May 29 '22 at 18:07
  • _"double clicking"_ precludes mobile operating systems where that isn't possible. Are you just developing a desktop app? – Andy May 29 '22 at 18:11
  • @Andy yes just for desktop – Insane_ banda May 29 '22 at 18:12
  • 2
    https://en.wikipedia.org/wiki/Native_(computing) – GrafiCode May 29 '22 at 18:13
  • 2
    Another helpful link I guess: https://xyproblem.info/ – ChrisG May 29 '22 at 18:27
  • It's not enough to ask for all the major OS. It also depends on the architecture. A binary for Windows on x86 usually won't run on Windows on ARM (e.g. Raspberry Pi). – jabaa May 29 '22 at 19:21
  • 1
    @GrafiCode I don't think it's obvious for the OP. I understand the question as: "Is it possible to create a binary, that can be run on all major systems/OS?" For us, it's obvious. For others, it could be a valid question. – jabaa May 29 '22 at 19:24
  • @jabaa I think you're right, after reading later comments I realized that. Sorry for being rude. – GrafiCode May 29 '22 at 19:59
  • @ChrisG that XY article was good. I have rephrased my question, can you please provide a feedback? – Insane_ banda May 30 '22 at 03:59
  • It sounds like [Docker](https://www.docker.com/resources/what-container/) is what you need (you cannot create a single executable though without rewriting everything) – ChrisG May 30 '22 at 10:12

0 Answers0