heroku nodejs 应用程序 - events.js:167 错误未处理 'error' 事件:生成 java ENOENT

heroku nodejs app - events.js:167 Error Unhandled 'error' event : spawn java ENOENT

我在 Heroku 上有一个使用 pdfMerge.js 库的 node-js 应用程序。

documentation 之后,我使用流事件机制作为回调来识别流程的结束

然后抛出异常: events.js:167 错误:生成 java ENOENT.

我几乎可以肯定它正在发生,因为我在搞乱所需的 java 安装,如下所述:

pdfmerger combines multiple PDF-files into a single PDF-file. It is a node module that utilizes the Apache PDFBox Library, which the required functionality are distributed along with this module. The only requirement for this module to run, is having Java 6 or higher in the path.

我对 Heroku installation/configuration 流程不够熟悉,无法使其正常工作。

提前致谢

您可以通过添加 heroku/jvm buildpack 将 Java 添加到您的应用程序,如下所示:

$ heroku buildpacks:add -i 1 heroku/jvm

然后使用 git commit --allow-emptygit push heroku master 重新部署。