Linux puppeteer 在 centos 6 上的执行

阅读(6787)

报错类似:

UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
/kaifage.com/node_modules/puppeteer/.local-chromium/linux-609904/chrome-linux/chrome:
error while loading shared libraries: libatk-bridge-2.0.so.0: cannot
open shared object file: No such file or directory

Centos 7

如果是Centos 7,安装依赖库就好,见:https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y

Centos 6

Puppeteer依赖的Chrome需要gtk3,gtk3需要Centos 7,无法在Centos 6 上执行。因此,除了尝试使用Firefox ESR外,尽量还是升级到Centos 7吧。

You have two choices really (ignoring Chromium, which no-one seems to
be keeping up-to-date for RHEL/CentOS 6):
1. Use Mozilla Firefox ESR via "yum install firefox" that is shipped with RHEL/CentOS 6. Unfortunately, this can be up to a year
out of date w.r.t. features compared to the more "normal" Mozilla
Firefox that you can download from Mozilla (but that "normal" Mozilla
Firefox is now also using GTK+3 and doesn't work on RHEL/CentOS 6
either).
2. Move to RHEL/CentOS 7, perhaps first in a VM before upgrading on bare metal once the VM is to your satisfaction. The latest Google
Chrome installs and runs out-of-the-box on RHEL/CentOS 7 (see below).

via: https://chrome.richardlloyd.org.uk/