I have setup a Laravel Sail environment and I am trying to save a webpage as a pdf using puppeteer.
I am currently using this package to run puppeteer via laravel - https://packagist.org/packages/spatie/browsershot
There requirements section specifies you need to download puppeteer via npm.
Laravel Sail has npm setup so I have installed the puppeteer package but when I try and save a webpage as a screenshot I get the following error
The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/var/www/html/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"https:\/\/google.com","action":"screenshot","options":{"type":"png","path":"\/var\/www\/html\/storage\/app\/public\/screenshot.png","args":[],"viewport":{"width":800,"height":600}}}'" failed. Exit Code: 1(General error) Working directory: /var/www/html/public Output: ================ Error Output: ================ Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (856583). at ChromeLauncher.launch (/var/www/html/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js:80:27) at async callChrome (/var/www/html/vendor/spatie/browsershot/bin/browser.js:69:23)
Its basically saying it can't find my local version of chromium and I'm not sure how to resolve this, if it wasn't running via docker I could install it locally and point to it but I don't think this is the best solution while using docker.