Однако, что бы я ни делал, мне не удается заставить его работать на работающем сервере.
Я запускаю его на Linux VPS.
Вот мой код (внутри контроллера):
Код: Выделить всё
use Illuminate\Http\Request;
use Spatie\Browsershot\Browsershot;
use Spatie\Image\Manipulations;
class screenshotController extends Controller
{
public function take($url){
$directory = "screenshots/" . date('m') . "/";
$id = uniqid(). ".jpeg";
if (!file_exists($directory)) {
mkdir($directory, 0777, true);
}
Browsershot::url("http://".$url)
->windowSize(1920, 1080)
->fit(Manipulations::FIT_CONTAIN, 525, 394)
->noSandbox()
->ignoreHttpsErrors()
->save($directory.$id);
return $directory.$id;
}
}
Вот какую ошибку я получаю:
Код: Выделить всё
(1/1) ProcessFailedException
The command "PATH=$PATH:/usr/local/bin NODE_PATH='/public_html/node_modules/' node
'/home/XXXX/public_html/vendor/spatie/browsershot/src/../bin/browser.js'
'{"url":"http:\/\/xxxxxxx.net","action":"screenshot","options":
{"type":"png","path":"screenshots\/09\/5d7e151bf330c.jpeg","args":["--no-sandbox"],"viewport":
{"width":1920,"height":1080},"ignoreHttpsErrors":true}}'" failed.
Exit Code: 127(Command not found)
Working directory: /home/XXXXX/public_html/public
Output:
================
Error Output:
================
sh: node: command not found
Я видел этот раздел в руководстве:
Код: Выделить всё
Browsershot::html('Foo')
->setNodeBinary('/usr/local/bin/node')
->setNpmBinary('/usr/local/bin/npm');
Буду очень благодарен за любую помощь.
Спасибо!>
Подробнее здесь: https://stackoverflow.com/questions/579 ... de-command
Мобильная версия