spatie / browsershot: What's causing 127 error generating PDF with Laravel?

223 Views Asked by At

This should be pretty straightforward, but I can't get it to work. This is on Mac OS 12.6x, MacBook M1.

  $html = view('auth.reports.pdf', $data)->render();
  return Browsershot::html($html)->save('test.pdf');

But it's giving me this error. If it's a path error, node and npm are in my $PATH. Can anyone point me in the right direction?

Symfony\Component\Process\Exception\ProcessFailedException
The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=`npm root -g` node '/Users/me/code/wisconsin-idea/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/var\/tmp\/816253635-0760445001674255800\/index.html","action":"pdf","options":{"path":"test.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false}}'" failed. Exit Code: 127(Command not found) Working directory: /Users/me/mydir/public Output: ================ Error Output: ================ sh: npm: command not found sh: node: command not found
0

There are 0 best solutions below