Render fails from command line
-
You did miss it here.
https://jsreport.net/learn/single-file-executable#running-full-serverAlthough 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.
Thetemplate.content
expects path to a raw file with content.
Perhaps something likedata/weeklyFoxiePerformance/content.handlebars
could work.
However thetemplate.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
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.
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.
Thetemplate.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 usingjsreport 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.
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 :-)