I've used Browsershot on another project with the same stack, and it worked fine. I copied the section of the docker file over to a new project I'm working on, and it's building fine, but browsershot is throwing an error that it can't find Chrome.
RUN apt-get update \
&& apt-get install -y gconf-service libasound2 libappindicator3-1 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libgbm-dev libatk-bridge2.0-0 \
&& npm install --global --unsafe-perm puppeteer \
&& chmod -R o+rx ~/.cache/puppeteer
Error: 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: /home/sail/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
at ChromeLauncher.resolveExecutablePath
(/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:298:27) at ChromeLauncher.executablePath (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:196:25) at ChromeLauncher.computeLaunchArguments (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:97:37) at async ChromeLauncher.launch (/var/www/html/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:79:28) at async callChrome (/var/www/html/vendor/spatie/browsershot/bin/browser.cjs:92:23)
What am I missing? I feel like this should be simple.
I'm running puppeteer v19.11.1.
UPDATE
I ran node node_modules/puppeteer/install.js
and got:
Chromium (1108766) downloaded to /home/user/.cache/puppeteer/chrome/linux-1108766
Same error.