-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pm2 not useable in electron production app #2651
Comments
Isn't it possible to launch pm2 programmatically? |
The API is documented here btw |
@soyuka it is. but this only works in dev mode. if packaged for distribution it ends up in a "respwan loop" (without pm2 being launched). same issue described here: http://stackoverflow.com/q/39796945/6486399
^ will work in dev mode unless packed for distribution. |
could you try adding a |
@vmarchaud running in noDaemonMode solved the problem. only issue is that pm2 gets killed when the app-process exits. is there a way to sucessfully launch the daemon (in production mode)? |
Remove the non-daemon mode ^^ |
@vmarchaud removing the non-daemon mode results in the described misbehaviour. i updated my last question for sake of clearness.
any idea how it could be fixed or how to make sure that this is the issue? (not sure if related to a potential file-access issue) - system log shows multiple entries of:
plist file does not exist. |
Run electron with |
Re-open if you have more informations |
The problem is line 226 in var child = require('child_process').spawn(process.execPath || 'node', node_args, {
Fixes could be one of:
ping @vmarchaud |
Its the daemon code so it isn't related to child process, maybe from here ? |
Not sure I understand what you mean... maybe I don't have the exact same issue as the original poster... This is what I'm doing in an electron process: const pm2 = require('pm2')
pm2.connect((err) => {
if (err) throw err
console.log('Success')
}) The problem is that the callback never gets called. If I step thru the code with the debugger, I can see that it tries to launch the process in If I look into
and if I modify |
My bad, i thought you were explaning that pm2 can't spawn electron process. |
Absolutely, what approach do you want to take? Check for |
No, we should always spawn the PM2 Daemon with node, so i'm pretty sure you can hardcode it. |
This may be related to another issue we had where But, IMO if someone has the above issue, it should be fixed on the target server (ie fix nodejs version conflicts). So 👍 to hard-code it! |
Published under pm2 |
I'm still having this issue. It is working fine in development mode but while packaged, I'm having the following issue:
|
I have the same problem, same error @LinusU had:
Does anyone knows how to get around this? |
Anyone could help please? |
I fixed this problem by electron/electron#8375 good luck @ndrantotiana @LinusU @vmarchaud @soyuka @matheusdavidson |
Found this, will test on my code |
@ayizhi did you make pm2 work with electron via changes in code? |
I found the issue is that Electron by default uses asar filesystem, so pm2 can't access files inside of it - I was able to make it work by adding asar: false into build config in package.json |
refering to electron/electron#8375
OS: OSX 10.11.6
node: 6.2.2
pm2: 2.2.3
in the meanwhile i managed to launch pm2 via nodes childprocess.exexFile (programmatic API usage still not possible) - and for some reason the arguments are not being parsed by pm2 if ran in production (electron app bundle) --> PM2 starts up, but the binary.json is not being used so the binary which should be managed by pm2 is not launched.
this works fine unless i run it in production (after packaging the electron application)
any idea what might be wrong or a hint where to look for potential bugs?
The text was updated successfully, but these errors were encountered: