jeudi 25 juin 2020

permission denied error with spatie/browsershot run

In my laravel 5 app I installed spatie/browsershot 3.37 and I got error on my server:

    The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/var/www/html/the-box-booking/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/1253868703-0501081001593084129\/index.html","action":"pdf","options":
{"path":"generate_profile_card_ybm8Xvk16rMUtQZXS0nUbZT9OdowS7upTFAU6iGr_tempfile.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /var/www/html/the-box-booking/public Output: ================ Error Output: ================ ┌──────────────────────────────────────────────────────┐ │ npm update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /var/www/.config │ └──────────────────────────────────────────────────────┘ Error: 
EACCES: permission denied, open 'generate_profile_card_ybm8Xvk16rMUtQZXS0nUbZT9OdowS7upTFAU6iGr_tempfile.pdf' -- ASYNC -- at Page.<anonymous> (/usr/lib/node_modules/puppeteer/lib/helper.js:116:19) at getOutput (/var/www/html/the-box-booking/vendor/spatie/browsershot/bin/browser.js:35:40) at callChrome (/var/www/html/the-box-booking/vendor/spatie/browsershot/bin/browser.js:236:24) at processTicksAndRejections (internal/process/task_queues.js:97:5) { errno: -13, code: 'EACCES', syscall: 'open', path: 'generate_profile_card_ybm8Xvk16rMUtQZXS0nUbZT9OdowS7upTFAU6iGr_tempfile.pdf' }

where /var/www/html/the-box-booking - app root

and with code :

$save_to_file     = 'generate_profile_card_' . Session::getId() . '_' . $filename_to_save;


if (strtolower($option_output_file_format) == 'pdf') {
    Browsershot::html(htmlspecialchars_decode($pdf_content))
               ->showBackground()
               ->save($save_to_file);  // ERROR POINTING THIS LINE

looks like I lack some permittions. Which ?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3g0KrUj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire