I tried to make as :
$save_to_file = storage_path( 'generate_profile_card_' . Session::getId() . '/' . $filename_to_save );
// it has value /mnt/_work_sdb8/wwwroot/lar/votes/storage/generate_profile_card/5/filename.pdf
Browsershot::html(htmlspecialchars_decode($pdf_content))
->showBackground()
->save($save_to_file);
and got error :
Symfony \ Component \ Process \ Exception \ ProcessFailedException
The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/mnt/_work_sdb8/wwwroot/lar/votes/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/0712247001562138587\/index.html","action":"pdf","options":{"path":"\/mnt\/_work_sdb8\/wwwroot\/lar\/votes\/storage\/generate_profile_card_Qwr94TQ4MqSagLRDf7jWP0ygk0rpcdbtCBWXz3az\/filename.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /mnt/_work_sdb8/wwwroot/lar/votes/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: ENOENT: no such file or directory, open '/mnt/_work_sdb8/wwwroot/lar/votes/storage/generate_profile_card_Qwr94TQ4MqSagLRDf7jWP0ygk0rpcdbtCBWXz3az/filename.pdf' -- ASYNC -- at Page.<anonymous> (/mnt/_work_sdb8/wwwroot/lar/votes/node_modules/puppeteer/lib/helper.js:110:27) at getOutput (/mnt/_work_sdb8/wwwroot/lar/votes/vendor/spatie/browsershot/bin/browser.js:26:40) at callChrome (/mnt/_work_sdb8/wwwroot/lar/votes/vendor/spatie/browsershot/bin/browser.js:148:24) at process._tickCallback (internal/process/next_tick.js:68:7) errno: -2, code: 'ENOENT', syscall: 'open', path: '/mnt/_work_sdb8/wwwroot/lar/votes/storage/generate_profile_card_Qwr94TQ4MqSagLRDf7jWP0ygk0rpcdbtCBWXz3az/filename.pdf' }
/mnt/_work_sdb8/wwwroot/lar/votes/ - root of the app OR
/_wwwroot/lar/votes - with linked path
I tried to run a command in error message above:
$ sudo chown -R $USER:$(id -gn $USER) /var/www/.config
chown: cannot access '/var/www/.config': No such file or directory
?