The command "node "C:\wamp64\www\Masampo-P1\vendor\spatie\browsershot\src/../bin/browser.cjs" "{""url"":""file:\/\/C:\\Users\\Kahilu\\AppData\\Local\\Temp\\1571387470-0974524001712322563\\index.html"",""action"":""pdf"",""options"":{""path"":""welcome.pdf"",""args"":[],""viewport"":{""width"":800,""height"":600},""displayHeaderFooter"":false,""printBackground"":true}}"" failed. Exit Code: 1(General error) Working directory: C:\wamp64\www\Masampo-P1\public Output: ================ Error Output: ================ 'node' is not recognized as an internal or external command, operable program or batch file.[Bug]: #119
Replies: 8 comments 7 replies
-
The same happened with me!!! |
Beta Was this translation helpful? Give feedback.
-
I fix this issue.
and it's will work with you |
Beta Was this translation helpful? Give feedback.
-
Having this same problem on a mac and the above did not fix it. What can I do? There is nothing weird about my system setup. I can run |
Beta Was this translation helpful? Give feedback.
-
Alright, for anyone wondering how to get around this without modifying vendor files, I had to find my local npm and node binaries and call
This let me use the package functionality. I think this might be an issue with using nvm locally? Regardless, for a staging and prod solution you would probably need to set those as env variables |
Beta Was this translation helpful? Give feedback.
-
Anyone got it working with nvm? |
Beta Was this translation helpful? Give feedback.
-
Update: I created a symlink for |
Beta Was this translation helpful? Give feedback.
-
Using ->noSandbox() ensures that Browsershot operates without sandboxing restrictions, which resolves common issues related to sandboxing errors when generating PDFs. This approach should enable successful PDF generation in your Laravel application, particularly addressing scenarios where sandboxing settings interfere with Browsershot's functionality. use Spatie\LaravelPdf\Facades\Pdf;
use Spatie\Browsershot\Browsershot;
// Example data (replace with your actual data)
$datas = [];
// Generate PDF with Browsershot, addressing "node" command issue
PDF::view('path.to.view', $datas)
->format('A4')
->margins(10, 10, 10, 10)
->withBrowsershot(function (Browsershot $browsershot) {
// Ensure Browsershot works without node command recognition issues
$browsershot->noNodeInstallation()->noSandbox()->scale(0.5);
})
->save('invoice.pdf'); Note: This solution is particularly effective on Windows where sandboxing configurations may differ from Unix-based systems. |
Beta Was this translation helpful? Give feedback.
-
I even managed to run it on Windows, but with simple html |
Beta Was this translation helpful? Give feedback.
-
What happened?
i expect it to work perfectly.
How to reproduce the bug
just run Php artisan serve after installing Node and npm install puppeteer and also installing composer require spatie/laravel-pdf
Package Version
1.4
PHP Version
8.2.0
Laravel Version
11.0.0
Which operating systems does with happen with?
Windows
Notes
This package was created on MacOs and is not properly implemented to look for Dependencies like node if its installed
Beta Was this translation helpful? Give feedback.
All reactions