Skip to content
This repository has been archived by the owner on Jun 20, 2020. It is now read-only.

Error: Could not start chrome: Error: spawn google-chrome-unstable ENOENT #5

Closed
lockevn opened this issue Sep 20, 2017 · 10 comments
Closed

Comments

@lockevn
Copy link

lockevn commented Sep 20, 2017

With Node 6.11.3 LTS and Node 8.5.0
Chrome Version 61.0.3163.91 (Official Build) (64-bit)

Using sample on https://nickjs.org/
It always say: "Error: Could not start chrome: Error: spawn google-chrome-unstable ENOENT"

Same environment, I run puppeteer normally

const puppeteer = require('puppeteer');
(async() => {
    const browser = await puppeteer.launch();
    console.log(await browser.version());
    browser.close();
})();

Result is HeadlessChrome/62.0.3198.0

@paps
Copy link
Member

paps commented Sep 20, 2017

By default NickJS tries to launch the google-chrome-unstable binary which is not in your PATH.

You can specify where it is with the CHROME_PATH environment variable, for example: export CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

Does that work?

@lockevn
Copy link
Author

lockevn commented Sep 20, 2017

I know that from the error message, but on Windows, you don't have google-chrome-unstable
And I don't see option to change the binary execution path for NickJS.

@paps
Copy link
Member

paps commented Sep 20, 2017

On Windows you can set environment variables too, as explained here: https://superuser.com/questions/79612/setting-and-getting-windows-environment-variables-from-the-command-prompt

You have to set CHROME_PATH to the exact path of you Google Chrome executable (chrome.exe)

@lockevn
Copy link
Author

lockevn commented Sep 21, 2017

OK, so NickJS read from CHROME_PATH by default.
On Windows, that variable is not set when installing Chrome.

You should take the executionpath as param for instantiate NickJS, or spawn the Chrome process in the same way as Chromeless/Puppeteer does.

@paps
Copy link
Member

paps commented Sep 21, 2017

CHROME_PATH is not set by default, on any OS. You have to set it yourself.

It's true that NickJS' launch could be improved in many ways. We'll continue improving it. In the meatime, PRs welcome :)

@paps paps closed this as completed Sep 21, 2017
@Ampix0
Copy link

Ampix0 commented Oct 27, 2017

I seem to not be able to get it to open Chrome either.

Error could not start chrome: Error: spawn C:\Program Files (x86)\Google\Chrome\Application Chrome.exe ENOENT

I just have this line at the top of my app.js

process.env['CHROME_PATH'] = C:\Program Files (x86)\Google\Chrome\Application Chrome.exe``

@paps
Copy link
Member

paps commented Nov 7, 2017

Can you try by declaring your environment variable in your shell or in the windows env?

@webstractions
Copy link

@Ampix0 @paps I think the following should work.

process.env.CHROME_PATH="C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"

Setting an environment variable on a remote machine may be difficult in some cases.

@holy-parmesan
Copy link

Is there an actual fix for this that works ?

@paps
Copy link
Member

paps commented Jul 9, 2018

Hi @laamb, there is. You have to make sure the CHROME_PATH environment variable contains the path to your Google Chrome executable.

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

No branches or pull requests

5 participants