Node.js 使用html pdf创建pdf时获取错误
试图在节点js中使用html pdf生成pdf,但出现以下错误Node.js 使用html pdf创建pdf时获取错误,node.js,phantomjs,ejs,html-pdf,Node.js,Phantomjs,Ejs,Html Pdf,试图在节点js中使用html pdf生成pdf,但出现以下错误 某些记录获取错误后-TypeError:无法读取未定义的属性“on” events.js:183 投掷者;//未处理的“错误”事件 ^ 错误:spawn/usr/local/lib/node_modules/phantomjs prebuild/lib/phantomjs/bin/phantomjs EAGAIN const filePathName = path.join(__dirname, '../../../view
const filePathName = path.join(__dirname, '../../../views/', "invoice.ejs");
const htmlString = fs.readFileSync(filePathName).toString();
let options = { format: 'Letter',"timeout": 600000 };
const ejsData = ejs.render(htmlString, data);
return pdf.create(ejsData, options).toFile(path.join(__dirname, '../../../tmp/', data.filename), (err, response) => {
if (err) return console.log('err',err);
return response;
});