brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 286 forks source link

Webshot fails on Meteor in DigitalOcean Ubuntu 14.04 #135

Open rudza opened 8 years ago

rudza commented 8 years ago

EDIT: webshot throws an error in DigitalOcean: webshot-error [Error: PhantomJS exited with return value 2]

I am using this code to generate pdf:

` let fileUri = process.env.PWD + '/storage/orders-pdf/' + fileName;

// Commence Webshot
webshot(html_string, fileUri, options, function(error) {
  fs.readFile(fileUri, function (err, data) {
    if (err) {
        return console.log(err);
    }

    fs.unlinkSync(fileUri);
    fut.return(data);
  });
});

let pdfData = fut.wait();`

The code works perfectly on localhost, but fails on the server and throws this error: { [Error: ENOENT, open '/opt/holi/storage/orders-pdf/Attributes.pdf'] errno: 34, code: 'ENOENT', path: '/opt/holi/storage/orders-pdf/Attributes.pdf' }

rudza commented 8 years ago

https://github.com/brenden/node-webshot/issues/123