Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to launch browser, error message: Failed to launch the browser process! #219

Open
evgeniy-kolmak opened this issue Nov 26, 2023 · 4 comments
Labels
question Further information is requested

Comments

@evgeniy-kolmak
Copy link

Version 4.0.0.
Locally everything works well. But when deploying to a server or docker container g I get an error message.

`Error: Unable to launch browser, error message: Failed to launch the browser process!
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2

TROUBLESHOOTING: https://pptr.dev/troubleshooting

at Cluster.<anonymous> (/usr/src/app/node_modules/puppeteer-cluster/src/Cluster.ts:168:19)
at Generator.throw (<anonymous>)
at rejected (/usr/src/app/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
at processTicksAndRejections (node:internal/process/task_queues:95:5)`

An older version cannot be installed because it points to deprecated packages.

@waqas-theneosolutions
Copy link

waqas-theneosolutions commented Jun 13, 2024

Any updates? facing same issue when deployed to server (ubuntu)

2|backend1 | TROUBLESHOOTING: https://pptr.dev/troubleshooting
2|backend1 | 
2|backend1 | Error: Unable to launch browser, error message: Failed to launch the browser process!
2|backend1 | [113690:113690:0613/144844.399980:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
2|backend1 | [0613/144844.407220:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
2|backend1 | [0613/144844.407376:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
2|backend1 | 
2|backend1 | 
2|backend1 | TROUBLESHOOTING: https://pptr.dev/troubleshooting
2|backend1 | 
2|backend1 |     at Cluster.<anonymous> (/home/ubuntu/code/node_modules/puppeteer-cluster/src/Cluster.ts:168:19)
2|backend1 |     at Generator.throw (<anonymous>)
2|backend1 |     at rejected (/home/ubuntu/code/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
2|backend1 |     at processTicksAndRejections (node:internal/process/task_queues:95:5)

@evgeniy-kolmak
Copy link
Author

You can solve the problem by installing Chromium.

Ubuntu

sudo apt install chromium-browser

For any environment (vps or docker container).

@waqas-theneosolutions
Copy link

I did installed chromium but then I got another error

Error: Unable to launch browser, error message: Failed to launch the browser process!
2|backend1  | [109360:109360:0613/080650.626809:FATAL:zygote_host_impl_linux.cc(127)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
2|backend1  | [0613/080650.634302:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
2|backend1  | [0613/080650.634352:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
2|backend1  | TROUBLESHOOTING: https://pptr.dev/troubleshooting
2|backend1  |     at Cluster.<anonymous> (/home/ubuntu/Hallabackend/node_modules/puppeteer-cluster/src/Cluster.ts:168:19)
2|backend1  |     at Generator.throw (<anonymous>)
2|backend1  |     at rejected (/home/ubuntu/Hallabackend/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
2|backend1  |     at processTicksAndRejections (node:internal/process/task_queues:95:5)

After spending hour to resolve this problem, I cam across a similar issue reported and resolved at stackoverflow https://stackoverflow.com/questions/59979188/error-failed-to-launch-the-browser-process-puppeteer Solution Add path to installed chromium within options resolved issue.

   const nodeHtmlToImageOptions: any = {
      output: '/image.png', // file for saving image
      html: html,
    };
    // Added 'puppeteerArgs' to resolve issue at server side for creating PNG 
    // Check the path where 'chromium-browser' is installed using command `which chromium-browser`
    // Paste that path for executablePath
    nodeHtmlToImageOptions.puppeteerArgs = {
      executablePath: '/usr/bin/chromium-browser',
    };
    nodeHtmlToImage(nodeHtmlToImageOptions).then(async () => {
    // Do something with response
    });

@frinyvonnick
Copy link
Owner

Did you check the troubleshooting section of Puppeteer documentation? https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

@frinyvonnick frinyvonnick added the question Further information is requested label Sep 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants