Calling npm module via exec fails in production


#1

Hi,

trying to use pm2 via programmatic API in production failed and i did not find the bug/a solution yet (discuss.atom.io thread / git issue ).

I did a workaround by calling pm2 from the “node_modules” folder and it works fine in dev mode unless packaged for distribution. When launching the packed executable nothing happens although confirmed the path is correct and the binary available there. any hint on what could be wrong?

original project (pm2 programmatic api): github.com/ca333/pm2_electron_app
workaround trial: github.com/ca333/pm2_launcher
both solutions work unless packaged with electron-packager.

error is reproducible on OSX, Linux, Windows.

the main goal is to spawn pm2 from within my electron app in production. (after packaged with electron packager)

offering 50$ worth of bitcoin for a solution or hint which leads to a solution. please post your public key together with your reply in case of a solution/hint.

thank you,
ca


#2

I solved the pm2 launch via child_process.execFile. Still looking for programmatic API integration of pm2. bounty set to 75 $ for a solution to: Electron app respawns itself

actually just need a (electron-packager) packaged application which successfully spawns the pm2 daemon with pm2.connect():

pm2.connect(function(err) { //start up pm2 god
  if (err) {
    console.error(err);
    process.exit(2);
  }
});