heroku - Heroku 上的 Puppeteer:无法启动浏览器进程
问题描述
我在 Heroku 上使用 Puppeteer 并收到以下错误:
Failed to launch the browser process! /usr/src/app/node_modules/puppeteer/.local-chromium/linux-756035/chrome-linux/chrome: error while loading shared libraries: libX11-xcb.so.1: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
解决方案
Declare browser as:
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox','--disable-setuid-sandbox'] })
Install
heroku buildpack
puppeteer heroku buildpackMust clear heroku cache
git add .
git commit -m "some text"
git push heroku master
推荐阅读
- java - 使用单个 UDP 套接字从 Java 中的不同线程读取/写入是否安全
- angular - Cloudinary 的上传小部件 v2 中的多个文件问题
- r - 如何按填充颜色对 ggplot2 中的条形图进行分组,同时保持降序?
- php - UNISERVER 严格表
- php - 错误:您的要求无法解析为一组可安装的软件包
- github - 有没有办法自动要求 PR 作者从分支/叉子中删除文件夹?
- selenium-webdriver - 无法使用 setFillBackgroundColor + apache poi 为 excel 单元格着色
- flutter - Flutter浮动按钮隐藏和显示ListView是否索引
- r - 如何将盒须图上的四分位数值带入序数尺度,以用作序数逻辑回归中的因变量?
- botframework - 如何使用机器人框架在团队频道的自适应卡片中添加提及