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

Support running inside asar packaged app #251

Closed
HaimBendanan opened this issue Feb 23, 2020 · 4 comments
Closed

Support running inside asar packaged app #251

HaimBendanan opened this issue Feb 23, 2020 · 4 comments
Labels

Comments

@HaimBendanan
Copy link

HaimBendanan commented Feb 23, 2020

I am using node-chromedriver as part of an application that is distributed to customers.
I am building the app with electron-builder, but get the following error on startup:

...Error: spawn ENOENT
    at errnoException (child_process.js...

I somehow narrowed down the issue to being related to asar packaging.
When packaging the app into an asar archive, the chromedriver will throw an error, but it will work as expected if not packaging as asar.
See the following links that discuss the issue:
https://www.electronjs.org/docs/tutorial/application-packaging
And here:
electron/electron#9459

Do you think that it would be possible to make chromedriver work from within an asar archive?

@giggio
Copy link
Owner

giggio commented Mar 3, 2020

I have no idea. I don't know asar.
The only place where we run a child process is this line:

const cp = child_process.spawn(chromedriverBinaryFilePath, ['--version']);

You could set the force download flag, and the whole method would be skipped, as per this line:

const forceDownload = process.env.npm_config_chromedriver_force_download === 'true' || process.env.CHROMEDRIVER_FORCE_DOWNLOAD === 'true';

See:

https://github.com/giggio/node-chromedriver#force-download

Are you able to do that?

@HaimBendanan
Copy link
Author

I ended up not using asar at all.
I think that the problematic line was the one below, is that possible?

const spawn = require("child_process").spawn;

Btw, in my use case, i am shipping an app that uses the chrome driver, so I need to handle cases where users have different chrome versions, and where they update chrome once in a while.
I ended up calling the install script every time my app start, to install the appropriate chrome version
Would be great if it was a built in functionality (I had to do some workarounds to make it works)

@giggio
Copy link
Owner

giggio commented Mar 3, 2020

Spawning the process is core to what this package does. If you run it, that's what it'll do. If you want to run it, how to do it without spawn?

Regarding the multiple versions, can you elaborate? What do you need?

@giggio
Copy link
Owner

giggio commented Mar 11, 2020

I'm closing it as I am not sure where this is going. Feel free to elaborate on a new issue.

@giggio giggio closed this as completed Mar 11, 2020
@giggio giggio added the invalid label Mar 11, 2020
Repository owner locked as resolved and limited conversation to collaborators Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants