Spawn detached node script from built Electron app


Hello, I’m building some sort of Server Manager that will mainly be used to configure processes in an “user friendly” environment.

The interface is pretty basic, and allows the creation of servers, configuring and starting/stopping them:

I am using forever-monitor to keep track of the instances, and manage the lifecycle of each server. That is working just great when I run electron directly from my app folder.

However, when I tryed to build and run it from a compiled app, each spawn of a new server instance was actually launching a new electron instance.

I then thought to specify the command in the spawn process, but that lead me to this error:

Uncaught Exception:
Error: spawn node ENOENT
    at exports._errnoException (util.js:949:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
    at onErrorNT (internal/child_process.js:348:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

And the file where I manage the processes and spawns them is this: