'Laravel Browsershot "node" not found

I got an error by using Browsershot in Laravel 8

(Laravel Code)

$content = view('welcome')->render();

return Browsershot::html($content)
    ->noSandbox()
    ->margins(18, 18, 24, 18)
    ->format('A4')
    ->showBackground()
    ->pdf(); }

Error

The command "node ^"C:^\xampp^\htdocs^\dashboard^\laravel8app^\vendor^\spatie^\browsershot^\src/../bin/browser.js^" ^"^{^\^"url^\^":^\^"file:^\/^\/C:^\^\Users^\^\User^\^\AppData^\^\Local^\^\Temp^\^\425041100-0302608001646305859^\^\index.html^\^",^\^"action^\^":^\^"pdf^\^",^\^"options^\^":^{^\^"args^\^":^[^\^"--no-sandbox^\^"^],^\^"viewport^\^":^{^\^"width^\^":800,^\^"height^\^":600^},^\^"displayHeaderFooter^\^":false,^\^"margin^\^":^{^\^"top^\^":^\^"18mm^\^",^\^"right^\^":^\^"18mm^\^",^\^"bottom^\^":^\^"24mm^\^",^\^"left^\^":^\^"18mm^\^"^},^\^"format^\^":^\^"A4^\^",^\^"printBackground^\^":true^}^}^"" failed. Exit Code: 1(General error) Working directory: C:\xampp\htdocs\dashboard\laravel8app\public Output: ================ Error Output: ================ Der Befehl "node" ist entweder falsch geschrieben oder konnte nicht gefunden werden. 


Solution 1:[1]

i fixed this with

       ->setNodeBinary('/usr/bin/node')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 andylondon