|-原 ubuntu 安装 Puppeteer 配合laravel采集
这个问题问得非常关键 👍
一、Puppeteer 在 Linux 到底缺什么?
- 字体
- 图形库
- 共享库
- 沙箱依赖
二、不同系统的安装命令(直接复制)
✅ Ubuntu / Debian(最常见)
sudo apt update
sudo apt install -y \
ca-certificates \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxkbcommon0 \
libxrandr2 \
libxshmfence1 \
libatspi2.0-0 \
libwayland-client0 \
libwayland-egl1 \
libepoxy0 \
libglib2.0-0 \
wget \
curl \
unzip✅ CentOS / Rocky / AlmaLinux
sudo dnf install -y \
alsa-lib \
atk \
cups-libs \
dbus-libs \
gtk3 \
libXcomposite \
libXcursor \
libXdamage \
libXext \
libXi \
libXrandr \
libXScrnSaver \
libXtst \
libX11 \
libX11-xcb \
libxcb \
nss \
mesa-libgbm \
wget \
curl \
unzip✅ Alpine(Docker 常用,不推荐新手)
apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ttf-freefont三、Puppeteer 自己的 Chrome(必须装)
cd your-laravel-project npm install puppeteer npx puppeteer browsers install chrome
Could not find Chrome (ver. 120.xxx)
四、Laravel + Puppeteer 的最小运行参数(防坑)
const browser = await puppeteer.launch({
headless: 'new',
args: [
'--no-sandbox',
'--disable-setuid-sandbox'
]
});- 服务器一般不用 root 跑桌面
- 不用 sandbox 会崩
五、验证是否成功(非常重要)
node douban-poster.js https://movie.douban.com/subject/1292874/
https://img9.doubanio.com/view/photo/l/public/p223...
- error while loading shared libraries→ 系统依赖没装全
- Chrome not found→ Puppeteer Chrome 没装
- Permission denied→ node 权限问题
六、Docker 用户(如果你以后用)
七、你现在的状态总结 ✅
项目 | 状态 |
|---|---|
cURL | ❌ 已被豆瓣封杀 |
PHP | ✅ 只负责调度 |
Node + Puppeteer | ✅ 唯一可行 |
Linux 依赖 | ✅ 上面已给 |
保存 JPG | ✅ 前面已解决 |
✅ 下一步我建议你选一个
你把服务器系统版本(cat /etc/os-release)贴出来,我可以给你精确到版本的依赖清单。...
|--原 Browser was not found at the configured executablePath (/root/.cache/puppeteer/chrome
Browser was not found at the configured executablePath (/root/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome) 一种情况是执行路径的文件不存在,还有就是执行路径的文件不限制执行
ls ~/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome
/root/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome
说明执行文件存在,在laravel的php的测试文件里用
dd(
is_executable('/root/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome')
); ,运行的报错是
is_executable(): open_basedir restriction in effect. File(/root/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome) is not within the allowed path(s): (/www/wwwroot/zimu/:/tmp/) 说明不允许执行
[2026-06-15 16:21:52] production.ERROR: Douban poster parse failed {"output":"Error: Browser was not found at the configured executablePath (/root/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome)
at ChromeLauncher.launch (file:///www/wwwroot/zimu/node_modules/puppeteer-core/lib/puppeteer/node/BrowserLauncher.js:60:19)...
|--原 "output":"Error: Failed to launch the browser process: Code: null
[2026-06-15 16:35:53] production.ERROR: Douban poster parse failed {"output":"Error: Failed to launch the browser process: Code: null
stderr:
chrome_crashpad_handler: --database is required
Try 'chrome_crashpad_handler --help' for more information.
[68784:68784:0615/163553.338438:ERROR:third_party/crashpad/crashpad/util/linux/socket.cc:120] recvmsg: Connection reset by peer (104)
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///www/wwwroot/zimu/node_modules/@puppeteer/browsers/lib/launch.js:339:24)
at ChildProcess.emit (node:events:531:35)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)
"}
[2026-06-15 16:35:53] production.ERROR: Douban poster parse failed {"output":"Error: Failed to launch the browser process: Code: null
stderr:
chrome_crashpad_handler: --database is required
Try 'chrome_crashpad_handler --help' for more information.
[68784:68784:0615/163553.338438:ERROR:third_party/crashpad/crashpad/util/linux/socket.cc:120] recvmsg: Connection reset by peer (104) ...