[Bug]: I'm getting BrowserShot error in my production environment, #222
Replies: 3 comments
-
npm is not installed |
Beta Was this translation helpful? Give feedback.
-
I encountered the same issue two months ago, and I remember that the problem was related to the Node.js path in WSL. In my case, the paths were set as follows: NODE_PATH=/home/linuxbrew/.linuxbrew/bin/node To resolve this, you can define these paths in the .env file and ensure they are correctly set in the production environment, as they might differ. Another approach is to specify the Node.js and npm paths directly in the Laravel controller when configuring Browsershot: Browsershot::html($htmlContent) I hope this helps anyone facing the same issue. 🚀 |
Beta Was this translation helpful? Give feedback.
-
After countless hours of searching and trying different things, This worked for me Setting up laravel-pdf which uses browsershot underneath which works with puppetter |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
DioExceptionType.badResponse
I/flutter ( 2571): ║ {
I/flutter ( 2571): ║ "message": "The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=npm root -g
I/flutter ( 2571): ║ node '/var/app/current/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"
I/flutter ( 2571): ║ file:///tmp/1684327513-0526073001737098123/index.html","action":"pdf","option
I/flutter ( 2571): ║ s":{"path":"/var/app/current/storage/app/public/giveaway_certificate_BINGIV
I/flutter ( 2571): ║ Y-YV0BNE.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter
I/flutter ( 2571): ║ ":false,"printBackground":true}}'" failed. Exit Code: 127(Command not found) Worki
I/flutter ( 2571): ║ ng directory: /var/app/current/public Output: ================ Error Output: =====
I/flutter ( 2571): ║ =========== sh: line 1: npm: command not found sh: line 1: node: command not found
I/flutter ( 2571): ║ "
I/flutter ( 2571): ║ "exception": "Symfony\Component\Process\Exception\ProcessFailedException",
I/flutter ( 2571): ║ "file": "/var/app/current/vendor/spatie/browsershot/src/Browsershot.php",
I/flutter ( 2571): ║ "line": 1088,
I/flutter ( 2571): ║ "trace": [
I/flutter ( 2571): ║ {
How to reproduce the bug
When trying to use Browsershot in server, this is coming
Package Version
1.0
PHP Version
8.3.11
Laravel Version
11
Which operating systems does with happen with?
Linux
Notes
No response
Beta Was this translation helpful? Give feedback.
All reactions