Answer the question
In order to leave comments, you need to log in
Error while running browsershot, what could be the problem?
How can I fix it?
THE CODE:
$dirPath = $str = preg_replace("#/$#", "", self::DEFAULT_PATH);
if (!file_exists($dirPath)) {
mkdir($dirPath, 0777, true);
}
$outputFile = $dirPath . '/' . sha1(uniqid()) . '.pdf';
try{
Browsershot::url(config('app.url') . '/chart?tool_id=' . $toolId . '&period=' . $periodId)
->save($outputFile);
}catch (\Exception $exception){
logger()->error($exception);
}
local.ERROR: Symfony\Component\Process\Exception\ProcessFailedException: The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/home/alpo4ino/test/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"http:\/\/test.log\/chart?tool_id=1&period=4","action":"pdf","options":{"path":"data\/tmp\/element\/3536785fcdc3c81449b01c31c942a33b1d9e9b9d.pdf","args":[],"viewport":{"width":800,"height":600},"executablePath":"\/usr\/lib\/chromium-browser"}}'" failed.
Exit Code: 1(General error)
Working directory: /home/alpo4ino/test/public
Output:
================
Error Output:
================
{ Error: spawn EACCES
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at Object.exports.spawn (child_process.js:502:9)
at Function.launch (/home/alpo4ino/test/node_modules/puppeteer/lib/Launcher.js:101:40)
at <anonymous> code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
in /home/alpo4ino/test/vendor/spatie/browsershot/src/Browsershot.php:488
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question