Try this:
spawn(cmd, ["--server", "--port", port], {
detached: true,
stdio: ['ignore', 'ignore', 'ignore']
});
I've not seen a single example of spawn
where everything was passed as the first argument. I've always seen it used with the first argument being only the command name (i.e. the executable name, or path to executable) and the second argument being an array of strings.
The fact that you were seeing a pid is not indicative of much because on Unix-type systems, the spawn
will fork
and then exec
. The fork
can be successful so you see a new pid but the exec
fails because the executable's name makes no sense to the OS.