Iva*_*nto 1 pdf node.js enoent
我需要阅读pdf文件,并使用pdf-text-extract。它在我的本地主机上完美运行。但是,当我尝试在服务器上运行程序时,出现以下错误
spawn called
{ '0': 'pdftotext',
'1':
[ '-layout',
'-enc',
'UTF-8',
'/tmp/the_file_name.pdf',
'-' ],
'2': { encoding: 'UTF-8', layout: 'layout', splitPages: true } }
events.js:72
throw er; // Unhandled 'error' event
Error: spawn ENOENT
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34)
Run Code Online (Sandbox Code Playgroud)
这是我的用法 pdf-text-extract
var extract = require('pdf-text-extract');
.....
.then (function () {
console.log(fs.readdirSync('/tmp'));
var extractAsync = Promise.promisify(extract);
return extractAsync(filePath);
})
.catch (function (err) {
console.log(err);
});
Run Code Online (Sandbox Code Playgroud)
如您所见,我添加了catch,但是为什么错误是未处理的“错误”事件。
我还检查了文件是否存在fs.readdirSync。是什么导致错误,我该如何解决?
| 归档时间: |
|
| 查看次数: |
1712 次 |
| 最近记录: |