Render fails from command line



  • You did miss it here.
    https://jsreport.net/learn/single-file-executable#running-full-server

    Although I understand that now the docs are fragmented between "command line" and "single exe". We will give it some work to improve it.



  • Oh, one additional question ... I've tried supplying the path to the files, but would still receive the error
    template.content option error: can't read file in /Users/Roger/Dev/nrlx/jsreportapp/data/weeklyFoxiePerformance (1).

    Using the details I've provided above, how would I construct a render command using template.content?

    Trying to stretch my wings here a bit. Thanks again.

     - Roger


  • You seem to be setting to the template.content path to the template folder.
    The template.content expects path to a raw file with content.
    Perhaps something like data/weeklyFoxiePerformance/content.handlebars could work.
    However the template.content is typically used when you don't have templates persisted by jsreport and you target raw html files (with handlebars inside).



  • ok, gotcha!

    Thanks again, and all the best to you and yours for the holidays!

     - Roger


  • Hi @jan_blaha ... I am moving over to our new report server and trying to run again from the command line, but now getting a different error. Image of the error(s) below. The new server is an Ubuntu box with nothing on it but git, nvm, npm, and jsreports. Can you look at the screen shot and let me know what's happening here? Thanks much, and please let me know if I should ask this in a separate thread - happy to do so.

    0_1672446147429_upload-9f1d39db-9e79-43d5-a1ae-80755f024467



  • You typically need to install some additional libs if you want to run chrome-pdf on ubuntu. See the installation instructions here
    https://jsreport.net/learn/ubuntu



  • Thanks again, @jan_blaha ... will try this. Much appreciated, and Happy New Year.



  • Hi again @jan_blaha ... hope you're having a terrific New Year!

    We are making great progress here! Your link to additional Ubuntu items for installation indeed fixed the problem and the report runs perfectly from the CLI ... thank you for that.

    New issue ... I'm trying to now call the CLI from Node as a child_process and passing it the command line details we have working above. However, I'm getting the following errors trying to do so. Can you help me construct a child_process command that will work here? Everything I've tried is failing.

    Here's my child_process (cp) call, followed by the error.
    0_1673911479920_upload-35cb05b5-2db2-43e5-a98a-071fa5838320

    0_1673911302920_upload-87919640-ca15-4870-91b2-064f1a85b292

    As you can see in the error, and fwiw, ${self.resources.globals.paths.appRoot}/ evaluates to /Users/Roger/Dev/nrlx

    Thanks in advance Jan. Always very much appreciated.



  • This looks like the same problem as before.
    The template.name should be the template name or path inside jsreport folder structure. Not an absolute path to the file system directory. In other words, if you start jsreport using jsreport start, you should open the studio and use the name or path you see in the entity tree panel.

    In your case the --template.name=weeklyFoxiePerformance could work.



  • Good morning Jan, and thanks for the very quick response here. I've actually tried a number of pathing options and none of them are working, including just naming the template as we did from the command line, and none of it seemed to work. That said, I tried it again this morning (as you suggested) on my new server and am now receiving this error, which is indeed progress, and I'm almost certain this is a simple fix.

    0_1673970562356_upload-12bbbb72-38ed-4d4e-b576-ff0d3a39e049

    Thanks again, @jan_blaha.

    FYI, Studio runs from here, as well as running jsreport render from the command line. This is showing up running the cp.execute() from Node.



  • https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback

    Try to pass the working directory cwd in the options with the path to the jsreport app, where is the config file.



  • NICE!! That worked ...

    cp.exec(xcommand, {cwd:"jsreports"}, function(err,stdout,stderr) { ...

    Thanks again, @jan_blaha ! I hope this is your toughest problem all year :-)


Log in to reply
 

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