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

Error: Failed to launch the browser process #112

Closed
mihailpettas opened this issue Dec 12, 2022 · 22 comments
Closed

Error: Failed to launch the browser process #112

mihailpettas opened this issue Dec 12, 2022 · 22 comments

Comments

@mihailpettas
Copy link

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)
@MarvynSTAR
Copy link

MarvynSTAR commented Dec 12, 2022

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.

@mihailpettas
Copy link
Author

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

@MarvynSTAR
Copy link

MarvynSTAR commented Dec 12, 2022

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?

@joao-bermal
Copy link

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

@transitive-bullshit
Copy link
Owner

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

@joao-bermal
Copy link

@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

@transitive-bullshit
Copy link
Owner

@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 transitive-bullshit changed the title Error: Failed to launch the browser process! Error: Failed to launch the browser process Dec 13, 2022
@zenxds
Copy link

zenxds commented Dec 13, 2022

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

@joao-bermal
Copy link

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.

2022-12-12.22-29-16.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

@transitive-bullshit
Copy link
Owner

@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.

@joao-bermal
Copy link

@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.

@transitive-bullshit
Copy link
Owner

transitive-bullshit commented Dec 13, 2022 via email

@transitive-bullshit
Copy link
Owner

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

@joao-bermal
Copy link

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

@mihailpettas
Copy link
Author

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?

@joao-bermal
Copy link

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

@transitive-bullshit
Copy link
Owner

@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
Copy link
Owner

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.

@gookyn
Copy link
Contributor

gookyn commented Dec 14, 2022

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?

@transitive-bullshit
Copy link
Owner

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

@tiger233
Copy link

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.

@transitive-bullshit
Copy link
Owner

@tiger233 you can use PUPPETEER_EXECUTABLE_PATH as the env var

SmileSmith pushed a commit to SmileSmith/chatgpt-api that referenced this issue Apr 7, 2023
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

7 participants