Could not find Chrome (ver. 118.0.5993.70). This can occur if either
1. you did not perform an installation before running the script (e.g. npm install) or
2. your cache path is incorrectly configured (which is: /app/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
chrome이 설치되어 있지 않으면, 위와 같은 에러 발생
사용 버젼: puppeteer@21.4.0
아래의 여러 초지중 정확한 인과관계를 파악하지는 못했습니다.
"heroku-postbuild": "mkdir ./.cache && mv /app/.cache/puppeteer ./.cache"
넣으면, 부팅 안됨.--no-sandbox
const browser = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu',
],
ignoreHTTPSErrors: true,
});
.puppeteerrc.cjs
https://stackoverflow.com/questions/74385208/puppeteer-error-on-heroku-could-not-find-chromium
https://pptr.dev/guides/configuration
const {join} = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
직접 설치
$ heroku run bash -a <APP>
$ node node_modules/puppeteer/install.mjs