Skip to content
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

Bad argument at ChildProcess.spawn #449

Closed
redloro opened this issue Jan 6, 2017 · 8 comments
Closed

Bad argument at ChildProcess.spawn #449

redloro opened this issue Jan 6, 2017 · 8 comments

Comments

@redloro
Copy link

redloro commented Jan 6, 2017

Got this working great on the Mac and then ported over to RPi to have it throw this error. After some digging find out that the Mac was running electron-html-to@2.2.0 and the RPi was running electron-html-to@2.3.0. After some additional digging find out that the call to get the Electron path is failing... the electron var actually has the entire electron object... not the Electron path.

And this issue is apparently also in electron-workers@1.10.0

electron = getElectronPathFromPackage('electron');

... actually returns the full Electron object and not the file path to the binary as indicated here: https://github.com/electron-userland/electron-prebuilt

Is something misconfigured or is there a simple workaround that I'm missing?

@bjrmatos
Copy link
Owner

bjrmatos commented Jan 6, 2017

hmm difficult to tell what is happening with no code to reproduce the issue.

what version of the electron package are you using?

@redloro
Copy link
Author

redloro commented Jan 6, 2017

I think 1.4.12 but I'd need to check to be sure... I'll also try and get some sample code posted here so you can see, but basically the require('electron') call always returns the full Electron object and not the actual path.

@bjrmatos
Copy link
Owner

bjrmatos commented Jan 6, 2017

are you calling require('electron') from a node.js app or a electron app? when require('electron') is called from an electron app it always will give you an object, when is called from a node app (or process) it will give you the path to the executable.

@redloro
Copy link
Author

redloro commented Jan 7, 2017

Correct... Calling it from an Electron app.

@bjrmatos
Copy link
Owner

bjrmatos commented Jan 7, 2017

this module is expected to be used inside a node.js app (node process), so i'm afraid that calling it from a electron app will not work right now.

@rcrodrigues
Copy link

rcrodrigues commented May 10, 2017

Having the same issue.
Using electron 1.6.x and electron-html-to 2.5.1

Uncaught Exception:
TypeError: Bad argument
    at ChildProcess.spawn (internal/child_process.js:289:26)
    at Object.exports.spawn (child_process.js:399:9)
    at /home/rcrodrigues/git/PRA_Federal/projetos/tmp/node_modules/electron-workers/lib/ElectronWorker.js:271:57
    at ElectronWorker.findFreePort (/home/rcrodrigues/git/PRA_Federal/projetos/tmp/node_modules/electron-workers/lib/ElectronWorker.js:122:9)
    at ElectronWorker.start (/home/rcrodrigues/git/PRA_Federal/projetos/tmp/node_modules/electron-workers/lib/ElectronWorker.js:211:10)
    at _loop (/home/rcrodrigues/git/PRA_Federal/projetos/tmp/node_modules/electron-workers/lib/ElectronManager.js:243:36)

@bjrmatos
Copy link
Owner

@rcrodrigues i'm not sure about your issue, do you have a test case where this error happens? just keep in mind that this package is not going to work if you are using it in an electron application, this package works when you use it from a node.js app

@NikhilMutkekar
Copy link

Same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants