node.jsnpmhtml-pdf

Node returns SIGSEGV error with html-pdf npm


var fs = require('fs');
var pdf = require('html-pdf');
var html = '<html><body><div>hi testing</div></body></html>'
var options = { format: 'Letter' };

pdf.create(html, options).toFile('./businesscard.pdf', function(err, res) {
  if (err) return console.log(err);
  console.log(res);
});

I am using this code to convert html to pdf using html-pdf. But I am continuously getting the same error

SIGSEGV

I am using the same code from long time. But suddenly from last few days, I started facing this error.

Node - v8.6.2
Npm - v6.4.1
html-pdf - v2.2.0

Solution

  • A SIGSEGV is an error(signal) caused by an invalid memory reference or a segmentation fault.
    segfault-handler module which catches segfaults on non-Windows platforms and generates a stack trace.