Error in rendering reports



  • Hi,

    Yes, we restarted pm2 after installing jsreport-phantom-pdf.

    This is the error we got while generating the PDF.

    { Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.
    at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/lib/client.js:64:23
    at ConcatStream.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:111:20)
    at ConcatStream.emit (events.js:208:7)
    at finishMaybe (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:475:14)
    at endWritable (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:485:3)
    at ConcatStream.Writable.end (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:455:41)
    at IncomingMessage.onend (_stream_readable.js:595:10)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
    remoteStack: 'Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.\n at module.exports (/home/jsreportapp/node_modules/jsreport-core/lib/util/createError.js:9:13)\n at Reporter.createError (/home/jsreportapp/node_modules/jsreport-core/lib/reporter.js:258:12)\n at invokeRender (/home/jsreportapp/node_modules/jsreport-core/lib/render/render.js:88:20)\n at <anonymous>' }

    Thank you for your support.


  • administrators

    just to be sure can you show the package.json of the project? also the output of the npm ls --depth=0 command



  • Hi,

    package.json content :
    {
    "name": "businessapp",
    "description": "business application",
    "main": "./app",
    "version": "0.1.0",
    "scripts": {
    "start": "node ./app",
    "test": "vows --spec --isolate",
    "predeploy": "echo This will be run before deploying the app",
    "postdeploy": "echo This will be run after deploying the app"
    },
    "dependencies": {
    "async": "",
    "bcrypt-nodejs": "
    ",
    "bunyan": "^1.2.3",
    "config": "",
    "connect": "
    ",
    "cron": "",
    "excel": "
    ",
    "express-fileupload": "^0.4.0",
    "files-and-folders": "",
    "formidable": "
    ",
    "hashmap": "",
    "hogan.js": "
    ",
    "java": "",
    "jsesc": "
    ",
    "jsreport": "^1.10.0",
    "jsreport-browser-client-dist": "^1.0.4",
    "jsreport-client": "^0.4.1",
    "jsreport-jsrender": "^1.0.2",
    "jsreport-phantom-pdf": "^1.4.6",
    "mandrill-api": "",
    "mime": "^1.3.6",
    "minio": "
    ",
    "moment": "",
    "mongodb": "
    ",
    "node-cache": "",
    "node-dir": "
    ",
    "node-jasper": "",
    "node-uuid": "
    ",
    "nodemailer": "",
    "nodemailer-ses-transport": "
    ",
    "numeral": "",
    "object-assign": "
    ",
    "path": "^0.12.7",
    "pdf-merge": "",
    "phantom-pdf": "^0.4.1",
    "q": "
    ",
    "rekuire": "",
    "request": "
    ",
    "restify": "2.7.0",
    "serve-static": "",
    "stripe": "
    ",
    "time": "",
    "underscore": "1.6.0",
    "vaap-common-service": "file:../node_packages/vaap-common-service",
    "vaap-mongodb": "file:../node_packages/vaap-mongodb",
    "vaap-tokenutil": "file:../node_packages/vaap-tokenutil",
    "vaap-util": "file:../node_packages/vaap-util",
    "vaap-ws": "file:../node_packages/vaap-ws",
    "validator": "
    "
    },
    "analyze": false,
    "devDependencies": {
    "vows": "0.7.0"
    },
    "license": "Commercial",
    "engines": {
    "node": ">=0.10.26"
    }
    }

    npm ls --depth=0 command output:

    +-- async@2.6.1
    +-- bcrypt-nodejs@0.0.3
    +-- bunyan@1.8.12
    +-- config@2.0.1
    +-- connect@3.6.6
    +-- cron@1.3.0
    +-- excel@1.0.0
    +-- express-fileupload@0.4.0
    +-- files-and-folders@0.0.14
    +-- formidable@1.2.1
    +-- hashmap@2.3.0
    +-- hogan.js@3.0.2
    +-- java@0.10.0
    +-- jsesc@2.5.1
    +-- jsreport@1.10.0
    +-- jsreport-browser-client-dist@1.1.0
    +-- jsreport-client@0.4.1
    +-- jsreport-jsrender@1.0.2
    +-- jsreport-phantom-pdf@1.4.6
    +-- mandrill-api@1.0.45
    +-- mime@1.6.0
    +-- minio@6.0.0
    +-- moment@2.22.2
    +-- mongodb@3.1.1
    +-- node-cache@4.2.0
    +-- node-dir@0.1.17
    +-- UNMET DEPENDENCY node-jasper@*
    +-- node-uuid@1.4.8
    +-- nodemailer@4.6.7
    +-- nodemailer-ses-transport@1.5.1
    +-- numeral@2.0.6
    +-- object-assign@4.1.1
    +-- path@0.12.7
    +-- pdf-merge@1.0.3
    +-- phantom-pdf@0.4.1
    +-- q@1.5.1
    +-- rekuire@0.1.9
    +-- request@2.87.0
    +-- restify@2.7.0
    +-- serve-static@1.13.2
    +-- stripe@6.5.0
    +-- time@0.12.0
    +-- underscore@1.6.0
    +-- vaap-common-service@0.1.0 -> /vaap/vaap/code/vaapdev/node/node_packages/vaap-common-service
    +-- vaap-mongodb@0.1.0 -> /vaap/vaap/code/vaapdev/node/node_packages/vaap-mongodb
    +-- vaap-tokenutil@0.1.0 -> /vaap/vaap/code/vaapdev/node/node_packages/vaap-tokenutil
    +-- vaap-util@0.1.0 -> /vaap/vaap/code/vaapdev/node/node_packages/vaap-util
    +-- vaap-ws@0.1.0 -> /vaap/vaap/code/vaapdev/node/node_packages/vaap-ws
    +-- validator@10.4.0
    `-- vows@0.7.0

    npm ERR! missing: node-jasper@, required by businessapp@0.1.0
    npm ERR! peer dep missing: react@^0.14 || ^15, required by react-copy-to-clipboard@4.3.0
    npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.10.0
    npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1
    npm ERR! missing: minimatch@3.0.4, required by ignore-walk@3.0.1
    npm ERR! missing: brace-expansion@1.1.11, required by minimatch@3.0.4
    npm ERR! missing: balanced-match@1.0.0, required by brace-expansion@1.1.11
    npm ERR! missing: concat-map@0.0.1, required by brace-expansion@1.1.11
    npm ERR! missing: console-control-strings@1.1.0, required by npmlog@4.1.2
    npm ERR! missing: inherits@2.0.3, required by readable-stream@2.3.6
    npm ERR! missing: safe-buffer@5.1.1, required by readable-stream@2.3.6
    npm ERR! missing: safe-buffer@5.1.1, required by string_decoder@1.1.1
    npm ERR! missing: console-control-strings@1.1.0, required by gauge@2.7.4
    npm ERR! missing: string-width@1.0.2, required by gauge@2.7.4
    npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
    npm ERR! missing: code-point-at@1.1.0, required by string-width@1.0.2
    npm ERR! missing: is-fullwidth-code-point@1.0.0, required by string-width@1.0.2
    npm ERR! missing: strip-ansi@3.0.1, required by string-width@1.0.2
    npm ERR! missing: number-is-nan@1.0.1, required by is-fullwidth-code-point@1.0.0
    npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1
    npm ERR! missing: string-width@1.0.2, required by wide-align@1.1.2
    npm ERR! missing: inherits@2.0.3, required by glob@7.1.2
    npm ERR! missing: minimatch@3.0.4, required by glob@7.1.2
    npm ERR! missing: once@1.4.0, required by glob@7.1.2
    npm ERR! missing: once@1.4.0, required by inflight@1.0.6
    npm ERR! missing: wrappy@1.0.2, required by inflight@1.0.6
    npm ERR! missing: wrappy@1.0.2, required by once@1.4.0
    npm ERR! missing: minipass@2.2.4, required by tar@4.4.1
    npm ERR! missing: mkdirp@0.5.1, required by tar@4.4.1
    npm ERR! missing: safe-buffer@5.1.1, required by tar@4.4.1
    npm ERR! missing: yallist@3.0.2, required by tar@4.4.1
    npm ERR! missing: minipass@2.2.4, required by fs-minipass@1.2.5
    npm ERR! missing: safe-buffer@5.1.1, required by minipass@2.2.4
    npm ERR! missing: yallist@3.0.2, required by minipass@2.2.4
    npm ERR! missing: minipass@2.2.4, required by minizlib@1.1.0
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-common-service/node_modules/vows
    npm ERR! extraneous: diff@1.0.8 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-mongodb/node_modules/diff
    npm ERR! extraneous: eyes@0.1.8 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-mongodb/node_modules/eyes
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-mongodb/node_modules/vows
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-mongodb/node_modules/vows
    npm ERR! missing: nodemailer@
    , required by vaap-util@0.1.0
    npm ERR! missing: nodemailer-ses-transport@, required by vaap-util@0.1.0
    npm ERR! missing: underscore@
    , required by vaap-util@0.1.0
    npm ERR! missing: path@, required by vaap-util@0.1.0
    npm ERR! missing: fs@
    , required by vaap-util@0.1.0
    npm ERR! missing: validator@, required by vaap-util@0.1.0
    npm ERR! missing: bunyan@
    , required by vaap-util@0.1.0
    npm ERR! missing: node-dir@, required by vaap-util@0.1.0
    npm ERR! missing: hogan.js@
    , required by vaap-util@0.1.0
    npm ERR! missing: async@, required by vaap-util@0.1.0
    npm ERR! missing: rekuire@
    , required by vaap-util@0.1.0
    npm ERR! missing: config@*, required by vaap-util@0.1.0
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-tokenutil/node_modules/vows
    npm ERR! extraneous: diff@1.0.8 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-util/node_modules/diff
    npm ERR! extraneous: eyes@0.1.8 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-util/node_modules/eyes
    npm ERR! missing: inherits@2.0.1, required by util@0.10.3
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-util/node_modules/vows
    npm ERR! extraneous: vows@0.7.0 /vaap/vaap/code/vaapdev/node/businessapp/node_modules/vaap-util/node_modules/vows
    npm ERR! missing: mkdirp@0.3.0, required by hogan.js@3.0.2

    Thanks


  • administrators

    @yamsgam @balajisr i'm a bit confused now, your package.json says that you are using jsreport v1, but all the steps i was mentioning in my previous comments were about jsreport v2, and according to @balajisr comments he was trying jsreport v2 too, but now i see that you have something different, not sure what is happening, could it be that you are not trying it in the right project?



  • Hi,

    Thank you for your support and time.

    Node modules are not updated to recent version.

    So I updated all modules using below commands:

    npm outdated
    npm install -g npm-check-updates
    ncu -u
    npm install

    Now using recent version of modules:

    "jsreport": "^2.1.1",
    "jsreport-browser-client-dist": "^1.0.4",
    "jsreport-client": "^1.0.0",
    "jsreport-jsrender": "^2.0.0",
    "jsreport-phantom-pdf": "^2.1.3",

    But still we are getting below error:

    { Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.
    at /vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/lib/client.js:64:23
    at ConcatStream.<anonymous> (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:111:20)
    at ConcatStream.emit (events.js:208:7)
    at finishMaybe (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:475:14)
    at endWritable (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:485:3)
    at ConcatStream.Writable.end (/vaap/vaap/code/vaapdev/node/businessapp/node_modules/jsreport-client/node_modules/readable-stream/lib/_stream_writable.js:455:41)
    at IncomingMessage.onend (_stream_readable.js:595:10)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
    remoteStack: 'Error: Recipe 'phantom-pdf' not found. If this is a custom recipe make sure it's properly installed from npm.\n at module.exports (/home/jsreportapp/node_modules/jsreport-core/lib/util/createError.js:9:13)\n at Reporter.createError (/home/jsreportapp/node_modules/jsreport-core/lib/reporter.js:258:12)\n at invokeRender (/home/jsreportapp/node_modules/jsreport-core/lib/render/render.js:88:20)\n at <anonymous>' }

    Please advice.


  • administrators

    are you using two projects? or are you using one project? if you are using one project i guess you are using two processes, one where you start jsreport server and another where you use jsreport-client to communicate with the jsreport server. it looks like you are not restarting the jsreport server after the npm updates. is the jsreport server in your same machine? or is it in another server with different ip? maybe you are not updating the server in which the jsreport server is running, all my comments about the updates should be done for the jsreport server.

    i think you are getting confused by the setup done in your side (or at least i'm with all the comments at this point). with the information that i have it is not clear to me how your setup looks like, we don't know the details about how are you starting the server or if you are using two different machines. i would say try to make it work the simplest way (without using pm2) and then after verify that you don't have any errors start to look at making it production ready (with the help of pm2)



  • Hi,

    We completely reinstalled node.js and jsreport in our server.

    Now we are not getting "Recipe 'phantom-pdf' not found Error".

    But we are not able to save templates. On click of save button, getting following error:

    Uncaught (in promise) TypeError: Cannot read property 'nameAttribute' of undefined
    at t.value (client.js?97f4c887fb1d5546bab6:77)
    at t.value (client.js?97f4c887fb1d5546bab6:77)
    at u.renderValidatedComponentWithoutOwnerOrContext (client.js?97f4c887fb1d5546bab6:74)
    at u.renderValidatedComponent (client.js?97f4c887fb1d5546bab6:74)
    at u.updateRenderedComponent (client.js?97f4c887fb1d5546bab6:74)
    at u.performComponentUpdate (client.js?97f4c887fb1d5546bab6:74)
    at updateComponent (client.js?97f4c887fb1d5546bab6:74)
    at u.receiveComponent (client.js?97f4c887fb1d5546bab6:74)
    at Object.receiveComponent (client.js?97f4c887fb1d5546bab6:2)
    at Object.updateChildren (client.js?97f4c887fb1d5546bab6:74)
    at g.reconcilerUpdateChildren (client.js?97f4c887fb1d5546bab6:75)
    at g.updateChildren (client.js?97f4c887fb1d5546bab6:75)
    at g.updateChildren (client.js?97f4c887fb1d5546bab6:75)
    at g._updateDOMChildren (client.js?97f4c887fb1d5546bab6:74)
    at g.updateComponent (client.js?97f4c887fb1d5546bab6:74)
    at g.receiveComponent (client.js?97f4c887fb1d5546bab6:74)

    Please advice.



  • Hi,

    We are able to eliminate all previous errors. But still report is not generating through our code.

    This is the log I got in terminal,

    2018-08-06T14:03:47.852Z - info: Starting rendering request 1 (user: vaapadmin)
    2018-08-06T14:03:47.857Z - info: Rendering template { name: CM_TaskOrder, recipe: chrome-pdf, engine: handlebars, preview: false }
    2018-08-06T14:03:47.859Z - debug: Inline data specified.
    2018-08-06T14:03:47.860Z - debug: Resources not defined for this template.
    2018-08-06T14:03:47.876Z - debug: Base url not specified, skipping its injection.
    2018-08-06T14:03:47.878Z - debug: Rendering engine handlebars
    2018-08-06T14:03:48.314Z - debug: Compiled template not found in the cache, compiling
    2018-08-06T14:03:48.320Z - debug: Executing recipe chrome-pdf
    2018-08-06T14:03:48.641Z - debug: Failed to load resource: net::ERR_FILE_NOT_FOUND
    2018-08-06T14:03:48.697Z - debug: Running chrome with params {"printBackground":true,"margin":{}}
    2018-08-06T14:03:48.809Z - debug: Skipping storing report.
    2018-08-06T14:03:48.819Z - info: Rendering request 1 finished in 967 ms

    In our code,

    var client = require("jsreport-client")(url, username, password);

                client.render({
                    template: {
                        name: reportName,
                        engine: 'handlebars',
                        recipe: 'chrome-pdf'
                    },
                    data: results.orderValues
                }, function (err, response) {
                    if (err) {
                        return console.error(err);
                    } else {
                        response.body(function (body) {
                            fs.writeFile(filePath, body, function (err) {
                                if (err) {
                                    console.log(err);
                                    return callback(err);
                                } else {
                                    callback(null, {
                                        path: filePath
                                    });
                                }
                            });
                        });
                    }
                });
    

    Kindly advice. Thanks for your time.



  • Hi,

    Any suggestion on this. Please advice.

    Thank You


  • administrators

    since your logs say that the report was generated correctly, the only hint that i have is that probably you are using the jsreport-client package in wrong after updating it (but i'm not sure at this point if you update it too or not). so i'm going to paste here my previous comment about that and you should verify that you have correct version of jsreport-client and that you are using it as expected.

    previous comment:

    what version of jsreport-client are you using? in latest one (jsreport-client 1.0.0) version calling client.render will return a promise (it is not expected a callback anymore), you can find example usage with latest version here.



  • Hi,

    PDF is generating. Thank you for your support.


Log in to reply
 

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