agentic icon indicating copy to clipboard operation
agentic copied to clipboard

Error: Failed to launch the browser process

Open mihailpettas opened this issue 2 years ago • 11 comments

Error: Failed to launch the browser process! spawn /Applications/Google Chrome.app/Contents/MacOS/Google Chrome ENOENT


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (C:\Users\User\Desktop\New folder\node_modules\puppeteer-core\lib\cjs\puppeteer\node\BrowserRunner.js:299:20)
    at ChildProcess.<anonymous> (C:\Users\User\Desktop\New folder\node_modules\puppeteer-core\lib\cjs\puppeteer\node\BrowserRunner.js:293:24)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Error: Failed to launch the browser process! spawn /Applications/Google Chrome.app/Contents/MacOS/Google Chrome ENOENT


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (C:\Users\User\Desktop\New folder\node_modules\puppeteer-core\lib\cjs\puppeteer\node\BrowserRunner.js:299:20)
    at ChildProcess.<anonymous> (C:\Users\User\Desktop\New folder\node_modules\puppeteer-core\lib\cjs\puppeteer\node\BrowserRunner.js:293:24)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

mihailpettas avatar Dec 12 '22 20:12 mihailpettas

I resolved, at least momentarily, by changing the following line in openai-auth.ts#129 to the real path of Chrome in my PC, which I got by going on the page chrome://version in the browser and copying the value Executable Path.

This makes the library work with little effort, but it's definitely an incorrect method. We have to wait for the developer to complete the function to make everything work without changes from us.

MarvynSTAR avatar Dec 12 '22 20:12 MarvynSTAR

that worked but i see it now works as a bot. cant it run normally?

mihailpettas avatar Dec 12 '22 20:12 mihailpettas

that worked but i see it now works as a bot. cant it run normally?

I don’t understand. You want the library not to take the cookies by itself?

MarvynSTAR avatar Dec 12 '22 21:12 MarvynSTAR

Screenshot from 2022-12-12 19-28-31

You can change the path of the chrome in this piece of code that you can find in the node_modules folder chatgpt at /build/index.js

joao-bermal avatar Dec 12 '22 22:12 joao-bermal

You can pass executablePath to override the default. We should definitely use better platform-aware defaults.

transitive-bullshit avatar Dec 12 '22 23:12 transitive-bullshit

@transitive-bullshit I fixed this but I could not make it work yet, what else do I need to config in order to work? Do I need some cookies or credentials to provide? Except for those which I config in the .env that are the email and password of my account

joao-bermal avatar Dec 13 '22 00:12 joao-bermal

@joao-bermal I'll need more info in order to help.

Try printing out the results of getOpenAIAuth. Make sure it all of the values are there. tbh I haven't tested on Windows, so something may be different.

Also, make sure you're using the real Chrome executable and not the puppeteer one because Cloudflare tends to block that one. If you post more info, I can help more (node.js version, how you've invoking the demo, all output, what happens in the headful browser, etc).

transitive-bullshit avatar Dec 13 '22 01:12 transitive-bullshit

You can pass executablePath to override the default. We should definitely use better platform-aware defaults.

https://github.com/GoogleChrome/chrome-launcher

ChromeLauncher.Launcher.getInstallations() this code will help you

zenxds avatar Dec 13 '22 01:12 zenxds

Hey, I recorded a little demo video, and also I'm sending some images that might help, my node version is v18.12.1. PS: Sorry for the bad English in the video. Hope you can understand.

https://user-images.githubusercontent.com/37602245/207204094-0f85e173-7add-4dd3-8a3c-5f2050afc6de.mp4

Screenshot from 2022-12-12 22-33-44 Screenshot from 2022-12-12 22-33-25 Screenshot from 2022-12-12 22-33-04 Screenshot from 2022-12-12 22-32-45 Screenshot from 2022-12-12 22-32-31

joao-bermal avatar Dec 13 '22 01:12 joao-bermal

@joao-bermal make sure you're setting email and password to two separate values in your call to getOpenAIAuth. Right now, it looks like you're using the same value for both of them.

transitive-bullshit avatar Dec 13 '22 06:12 transitive-bullshit

@transitive-bullshit actually I've realized that and I changed to my email and password but still exacly the same result. I think that's because I'm trying to login with the google account, I'll try to create an account with email and password and see if this changes something.

joao-bermal avatar Dec 13 '22 17:12 joao-bermal

Only standard email & password is supported for the automated solution at this time.

transitive-bullshit avatar Dec 13 '22 18:12 transitive-bullshit

The browser location issue will be fixed by #126 or #124

transitive-bullshit avatar Dec 13 '22 18:12 transitive-bullshit

Yes, now I've tried to make it work logining with only email and password but it still shows the same error, I think that I should probably pass some information about my ChatGPT like session token and stuff.

Screenshot from 2022-12-13 17-16-08

joao-bermal avatar Dec 13 '22 20:12 joao-bermal

that worked but i see it now works as a bot. cant it run normally?

I don’t understand. You want the library not to take the cookies by itself?

sorry i meant not doing this whole open browser operation. is this because of the new restrictions they applied?

mihailpettas avatar Dec 13 '22 20:12 mihailpettas

@stojanni Yes, this is probably because of the cloudflare protection they implemented

joao-bermal avatar Dec 13 '22 21:12 joao-bermal

@stojanni the new Cloudflare protections unfortunately made this whole process much more complicated.

Keep in mind that this is providing extremely early access to ChatGPT and is intended to help devs start building awesome stuff on top of it — but it won't be 100% stable until the official API is released, and we don't have any word yet on when that will be.

transitive-bullshit avatar Dec 14 '22 01:12 transitive-bullshit

The original bug for this issue has been resolved in: https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.3.1

If you have other problems, please open a new issue with a detailed account of the problem you're running into.

transitive-bullshit avatar Dec 14 '22 02:12 transitive-bullshit

The original bug for this issue has been resolved in: https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.3.1

If you have other problems, please open a new issue with a detailed account of the problem you're running into.

@transitive-bullshit

I cloned the latest version and wanted to run the demos, but this problem occurred.

Is it possible to get command line parameters npx tsx demos/demo.ts --chrome-path=xxx or environment variables process.env.CHROME_PATH to override the default chrome path?

gookyn avatar Dec 14 '22 08:12 gookyn

@gookyn thank's for the windows PR. Yes, I like the idea of CHROME_PATH

transitive-bullshit avatar Dec 14 '22 11:12 transitive-bullshit

The original bug for this issue has been resolved in: https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.3.1 If you have other problems, please open a new issue with a detailed account of the problem you're running into.

@transitive-bullshit

I cloned the latest version and wanted to run the demos, but this problem occurred.

Is it possible to get command line parameters npx tsx demos/demo.ts --chrome-path=xxx or environment variables process.env.CHROME_PATH to override the default chrome path?

can i deploy it in linux vm? when i command npx tsx demos/demo.ts, show same wrong information.

tiger233 avatar Dec 19 '22 20:12 tiger233

@tiger233 you can use PUPPETEER_EXECUTABLE_PATH as the env var

transitive-bullshit avatar Dec 19 '22 20:12 transitive-bullshit