Facing issue while setup browsershot in server #828
Replies: 1 comment
-
For me it the problem was that I installed chrome in an inaccessible directory. I added a config file "project-directory/.puppeteerrc.cjs", with this:
Chek this out https://pptr.dev/guides/configuration#configuration-files. This did fix the error, then I got some errors for missing dependencies, I installed them. But now I get
|
Beta Was this translation helpful? Give feedback.
-
The command "PATH=$PATH:/home/ubuntu/.nvm/versions/node/v20.11.1/bin NODE_PATH=
npm root -g
node '/var/www/html/order_dev/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"file:///tmp/894557859-0799827001710739477/index.html","action":"screenshot","options":{"type":"png","path":"orderbill/new.png","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"ignoreHttpsErrors":true}}'" failed. Exit Code: 1(General error) Working directory: /var/www/html/order_dev/public Output: ================ Error Output: ================ /usr/bin/env: 'node': No such file or directory Error: Could not find Chrome (ver. 122.0.6261.128). This can occur if either 1. you did not perform an installation before running the script (e.g.npx puppeteer browsers install chrome
) or 2. your cache path is incorrectly configured (which is: /var/www/.cache/puppeteer). For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration. at ChromeLauncher.resolveExecutablePath (/var/www/html/order_dev/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:285:27) at ChromeLauncher.executablePath (/var/www/html/order_dev/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:196:25) at ChromeLauncher.computeLaunchArguments (/var/www/html/order_dev/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ChromeLauncher.js:89:37) at async ChromeLauncher.launch (/var/www/html/order_dev/node_modules/puppeteer-core/lib/cjs/puppeteer/node/ProductLauncher.js:70:28) at async callChrome (/var/www/html/order_dev/vendor/spatie/browsershot/bin/browser.cjs:92:23)i setup v20.11.1
aslov
whereis node
node: /usr/local/bin/node /home/ubuntu/.nvm/versions/node/v20.11.1/bin/node this is the path that i gavi in my code
Route::get('test-html', function () {
$html = View::make('bill_template')->render();
Browsershot::html($html)
});
Beta Was this translation helpful? Give feedback.
All reactions