Настроить node.js Puppeteer на VPS

1 000 руб. за проект
13 июня 2024, 10:29 • 3 отклика • 54 просмотра
Есть простое NodeJS приложение, формирующее PDF со страниц нашего сайта через Puppeteer https://pptr.dev/ по запросу.

На хостинге работает нестабильно, иногда получаем
"status": "get file failed",
"reason": "Error: Could not find Chrome (ver. 117.0.5938.149). This can occur if either\n 1. you did not perform an installation before running the script (e.g. `npm install`) or\n 2. your cache path is incorrectly configured (which is: /[....path....]/.cache/puppeteer).\nFor (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration."
}

Такая проблема встречается у многих, примерные пути решения описаны тут:
https://stackoverflow.com/questions/77779601/error-could-not-find-chrome-ver-119-0-6045-105-this-can-occur-if-either

Пробовали их, но нам не помогло.
То доступен Chrome, то нет.

Нужно докрутить так, чтобы puppeteer всегда находил движок