0
나는 phamton-html-to-pdf 및 ejs를 사용하여 pdf를 만들려고합니다. 설치 작업은 내 로컬 dev env에서 greate하지만 생산에서는 greate가 아닙니다. 문제는 내 서버에서 prod가 생성되었지만 비어 있다는 것입니다. 팬텀 관리자가 모든 직원을 시작할 수 없습니다.
{ Error: phantom manager could not start all workers..
at /home/website/group-auto.com/node_modules/phantom-workers/lib/phantomManager.js:66:47
at /home/website/group-auto.com/node_modules/phantom-workers/lib/phantomWorker.js:115:24
at /home/website/group-auto.com/node_modules/phantom-workers/lib/phantomWorker.js:140:20
at Socket.<anonymous> (/home/website/group-auto.com/node_modules/phantom-workers/lib/checkPortStatus.js:45:9)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:497:12)
[ { Error: Command failed: /home/website/group-auto.com/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom/bin/phantomjs --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any /home/website/group-auto.com/node_modules/phantom-html-to-pdf/lib/scripts/serverScript.js
/home/website/group-auto.com/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom/bin/phantomjs: 1: /home/website/group-auto.com/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom/bin/phantomjs: Syntax error: word unexpected (expecting ")")
at ChildProcess.exithandler (child_process.js:198:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket.<anonymous> (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
killed: false,
code: 2,
signal: null,
cmd: '/home/website/group-auto.com/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom/bin/phantomjs --ignore-ssl-errors=yes --web-security=false --ssl-protocol=any /home/website/group-auto.com/node_modules/phantom-html-to-pdf/lib/scripts/serverScript.js' },
const ejs = require('ejs');
const fs = require('fs');
const conversion = require("phantom-html-to-pdf")({
\t \t phantomPath: require("phantomjs-prebuilt").path
});
function createPdf (data, template, directory) {
\t var options = {};
\t var html = ejs.renderFile(__dirname + `/template/${template}.ejs`, {data: data}, options, function(err, str){
\t \t if(err){
\t \t \t return err
\t \t }
\t return str
\t });
\t var filepath = null
\t conversion({ html: html, printDelay: 5000}, (err, pdf) => {
\t \t var output = fs.createWriteStream(`documents/${directory}/${data.Référence}.pdf`)
\t \t pdf.stream.pipe(output);
\t });
}
module.exports = createPdf;