Render fails from command line

  • Hi all, and thanks in advance. No matter what I do, I cannot seem to get a render to happen from the command line. JS Studio renders everything fine.

    Here are all the details I can think of, but please let me know if I'm missing something - which I know I am. Thanks again.

    Set up looks like this

    OS: Mac OS-X Monterey
    jsreport directory: jsreportapp

    template directory: jsreportapp/data 0_1671554338314_upload-18b62399-b22c-417a-b8f6-1158a70eddb6

    All reports located: jsreportapp/data/
    Main Report: weeklyFoxiePerformance
    Child Report 1: weeklyFoxieSummary
    Child Report 2: weeklyFoxieChildSales
    Child Report 3: weeklyFoxieSMSDetails
    Child Report 4: weeklyFoxieChildDIDs
    Child Report 5: weeklyFoxieVoiceDetails

    Data file: jsreportapp/foxiePerfDataAll.json

    CLI render command:
    jsreport render

    running render command above yields this/these errors

  • Almost forgot, in case it is needed, here is my config file:

    location: jsreportapp/jsreport.config.json

      "httpPort": 5488,
      "store": {
        "provider": "fs"
      "blobStorage": {
        "provider": "fs"
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
      "trustUserCode": true,
      "reportTimeout": 60000,
      "workers": {
        "numberOfWorkers": 2
      "extensions": {
        "authentication": {
          "cookieSession": {},
          "admin": {
            "username": "admin",
            "password": "password"
          "enabled": false
        "sample-template": {
          "createSamples": true
        "fs-store": {
          "dataDirectory": "data"

  • The --template.content expects a file path. In your case you have your templates persisted so you can just select them using So something like this

    jsreport render

  • @jan_blaha ... thank you so much - that worked!

    I've scoured the documentation and didn't see the name as an option ... is there a documentation repository with these details available?

    Love the product and really appreciate your help.

  • You did miss it here.

    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.


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

  • 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.


    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 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 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.


    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.


    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.