Error while running a report in a fresh new installation



  • Here's the full error:

    Error occured - Error during rendering report: Cannot read property 'forEach' of undefined
    Stak - TypeError: Cannot read property 'forEach' of undefined
    at D:\projetos\jsreport\node_modules\jsreport-core\lib\render\render.js:97:19
    at tryCatcher (D:\projetos\jsreport\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\projetos\jsreport\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (D:\projetos\jsreport\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (D:\projetos\jsreport\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\projetos\jsreport\node_modules\bluebird\js\release\promise.js:693:18)
    at Promise._fulfill (D:\projetos\jsreport\node_modules\bluebird\js\release\promise.js:638:18)
    at D:\projetos\jsreport\node_modules\bluebird\js\release\nodeback.js:42:21
    at Request._callback (D:\projetos\jsreport\node_modules\script-manager\lib\manager-servers.js:215:5)
    at Request.self.callback (D:\projetos\jsreport\node_modules\script-manager\node_modules\request\request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (D:\projetos\jsreport\node_modules\script-manager\node_modules\request\request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (D:\projetos\jsreport\node_modules\script-manager\node_modules\request\request.js:1085:12)
    at IncomingMessage.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)


  • administrators

    can you show what is the report template that you are trying to render? seems like you have a mistake in there.


  • administrators

    maybe you are just missing to add/pass some data to the template



  • It was just a simple page containing a {{teste}} variable. Even when I try to run the default examples(invoice) I've got the same error. My intention is having a working local installation to add wkhtmltopdf



  • Which engine do you use? Can you run the template in debug and paste the logs?
    How do you install jsreport? Which version? Can you share the config if there were changes? Based on the stack there were.
    Thank you



  • I've tried to use default option( phantom-js and handlebars).
    OS: Windows 10
    Node version : 6.10.2 (when I tried to use 8.9.4 I couldn't startup the server )
    npm version : 5.6.0
    steps used : npm install jsreport-cli > jsreport configure > jsreport init > jsreport start
    weird stuff while installing : jsreport init command can't find jsreport installation and needs to be terminated with ctrl+c .

    Here's the debug log when I run invoice or any template:

    Error occured - Error during rendering report: Cannot read property 'forEach' of undefined
    logs:
    +0 Starting rendering request 2
    +4 Rendering template {shortid:rkJTnK2ce, recipe:phantom-pdf, engine:handlebars, preview:true}
    +4 Adding sample data Sy5S19ncg
    +14 Replaced assets ["Invoice styles.css","Invoice logo.png"]
    +15 Resources not defined for this template.
    +17 Base url not specified, skipping its injection.
    +17 Rendering engine handlebars
    Stak - TypeError: Cannot read property 'forEach' of undefined
    at D:\projetos\report\node_modules\jsreport-core\lib\render\render.js:97:19
    at tryCatcher (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\promise.js:693:18)
    at Promise._fulfill (D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\promise.js:638:18)
    at D:\projetos\report\node_modules\jsreport-core\node_modules\bluebird\js\release\nodeback.js:42:21
    at Request._callback (D:\projetos\report\node_modules\script-manager\lib\manager-servers.js:215:5)
    at Request.self.callback (D:\projetos\report\node_modules\script-manager\node_modules\request\request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (D:\projetos\report\node_modules\script-manager\node_modules\request\request.js:1163:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (D:\projetos\report\node_modules\script-manager\node_modules\request\request.js:1085:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)


  • administrators

    @iconte can you please zip your D:\projetos\report directory as it is (all the files and directories in there) and send it to me at bjrmatos@gmail.com? that would help to know what could be the cause of this issue. thanks.


  • administrators

    i have checked your project but the error that you are getting never happens for me, however i have noticed that the zip that you sent to me does not contain a phantomjs executable at [project path]\node_modules\phantomjs\lib\phantom\phantomjs.exe, that makes me think that somehow the installation was bad for you, also your package.json does not contain jsreport in there and does not match with the output that jsreport init should produce.

    do you have some kind of proxy in your local network? the proxy can make the installation to skip some files which leads to having a bad jsreport installation, if you have a proxy please try to disable it or allow everything just for your test.

    do you have an antivirus in your computer? the antivirus can also make the installation to fail or just block phantomjs, if you have one please try to disable it just for your test.

    i have done like 3 or 4 fresh installs on my windows VM and everything works, so something must went wrong for you when installing. my best advice is to delete everything, check for proxy or antivirus in your machine, disable them, then:

    • npm install -g jsreport-cli
    • jsreport init
    • jsreport configure
    • jsreport start


  • is it normal jsreport init take so much time( > 2min)?


  • administrators

    is it normal jsreport init take so much time( > 2min)?

    in my windows VM it takes the same sometimes, so i would say yes, after all it just run npm install under the hood and create some files, the bottleneck is npm install so nothing we can do to improve it. fortunately it is just the initial command that installs the whole project.


Log in to reply
 

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