Cannot find module 'phantomjs'



  • Hello,

    I have upgraded jsreports to the latest version but started getting this error. Application is still using phantomPDF. It works fine with the older configuration.

    Here is how the package.json looks like. It works fine locally but throws phantomjs error when uploaded to the aws.

    "dependencies": {
    "jsreport": "^4.0.0",
    "@jsreport/jsreport-cli": "4.0.2",
    "phantom-pdf":"0.4.1",
    "@jsreport/jsreport-phantom-pdf": "^4.0.0"
    }
    }

    Would appreciate any pointers on what I could be doing wrong?

    Cannot find module 'phantomjs'
    Require stack:

    • /var/app/current/node_modules/phantom-workers/lib/phantomWorker.js
    • /var/app/current/node_modules/phantom-workers/lib/phantomManager.js
    • /var/app/current/node_modules/phantom-workers/index.js
    • /var/app/current/node_modules/phantom-html-to-pdf/lib/serverStrategy.js
    • /var/app/current/node_modules/phantom-html-to-pdf/lib/conversion.js
    • /var/app/current/node_modules/phantom-html-to-pdf/index.js
    • /var/app/current/node_modules/@jsreport/jsreport-phantom-pdf/lib/recipe.js
    • /var/app/current/node_modules/@jsreport/jsreport-phantom-pdf/lib/worker.js
    • /var/app/current/node_modules/@jsreport/jsreport-core/lib/worker/extensionsManager.js
    • /var/app/current/node_modules/@jsreport/jsreport-core/lib/worker/reporter.js
    • /var/app/current/node_modules/@jsreport/jsreport-core/lib/worker/workerHandler.js
    • /var/app/current/node_modules/@jsreport/advanced-workers/lib/workerHandler.js
      Error: Cannot find module 'phantomjs'


  • Perhaps it helps if you check how we install phantomjs for playground
    https://github.com/jsreport/playground-worker/blob/master/Dockerfile#L12



  • Thank you for the pointer @admin. That helped me figure this out.

    For anyone else having this issue:-
    I was using the phantomjs-prebuilt package which wasn't working. When I used 1.9.8 as per the link shared by the @admin it worked :)


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.