error while loading shared libraries: libXss.so.1:

葛学民
2023-12-01

git clone https://github.com/GoogleChrome/puppeteer

cd puppeteer

 

$ npm install

> puppeteer@1.18.0-post install /home/mzh/github.com/GoogleChrome/puppeteer
> node install.js

Downloading Chromium r669486 - 347.1 Mb [====================] 100% 0.0s 
Chromium downloaded to /home/mzh/github.com/GoogleChrome/puppeteer/.local-chromium/linux-669486
ERROR: Failed to download Chromium r669486! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
Error: Failed to launch chrome!
/home/mzh/github.com/GoogleChrome/puppeteer/.local-chromium/linux-669486/chrome-linux/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory


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

    at onClose (/home/mzh/github.com/GoogleChrome/puppeteer/lib/Launcher.js:340:14)
    at Interface.helper.addEventListener (/home/mzh/github.com/GoogleChrome/puppeteer/lib/Launcher.js:329:50)
    at Interface.emit (events.js:203:15)
    at Interface.close (readline.js:397:8)
    at Socket.onend (readline.js:173:10)
    at Socket.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@1.18.0-post install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the puppeteer@1.18.0-post install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mzh/.npm/_logs/2019-06-24T01_27_04_246Z-debug.log
 

解决措施:

sudo yum -y install libXScrnSaver-1.2.2-6.1.el7.x86_64

继续npm install

(node:28704) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[0624/095308.093396:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/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.
 

 

TODO: 

爬虫利器 Puppeteer 实战  https://www.jianshu.com/p/a9a55c03f768

 

 

 类似资料: