Search code examples
javanode.jsherokupdfboxspawn

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


I'm having a node-js app on Heroku using the pdfMerge.js library.

following the documentation I'm using the stream event mechanism as a callback to identify the end of the process

then an exception is thrown : events.js:167 Error: spawn java ENOENT.

I'm almost sure it's happening because I'm messing required java installation as described here:

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.

I'm Not familiar enough with Heroku installation/configuration process in order to make it work.

thanks in advance


Solution

  • You can add Java to your app by adding the heroku/jvm buildpack like this:

    $ heroku buildpacks:add -i 1 heroku/jvm
    

    Then redeploy with git commit --allow-empty and git push heroku master.