在启动Puppeteer时,我遇到了一个问题。
(node:13392) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
/var/www/html/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
我找到了 https://pkgs.org/download/libatk-bridge-2.0.so.0()(64bit) 并选择了 CentOS 7 版本 ,因为找不到 CentOS 6 的版本。 根据这个,我输入了:
yum install at-spi2-atk
但却获得了
Loaded plugins: fastestmirror
Setting up Install Process
Repository remi-php71 is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* atomic: www6.atomicorp.com
* base: mirror.checkdomain.de
* epel: mirror.wiuwiu.de
* extras: mirror.checkdomain.de
* remi: mirror.23media.com
* remi-php54: mirror.23media.com
* remi-php71: mirror.23media.com
* remi-safe: mirror.23media.com
* updates: mirror.imt-systems.com
* webtatic: uk.repo.webtatic.com
No package at-spi2-atk available.
Error: Nothing to do
顺便提一下,在Windows 7上使用Puppeteer没有任何问题
背景
CentOS 6,node v10.16.1
代码
const puppeteer = require('puppeteer');
const url = 'https://thepage.com.ua/';
puppeteer
.launch(function() {
console.log('puppeteer launched')
})
.then(function(browser) {
console.log('browser OK')
return browser.newPage();
})