Install ejs engine
-
this screenshot is taken from jsreport playground. Here is the actual screenshot
![alt text]( image url)
-
hmm if you installed
ejs
withnpm install jsreport-ejs
the extension should be loaded, what is the content of yourpackage.json
? and what are the full logs that you get when starting jsreport?
-
Content of package.json in jsreportapp folder. I can see the node_module
jsreport-ejs
injsreportapp\node_module
folder. I don't know which step am i missing to make it work. Our most of reporting templates are written in ejs, so its super important for us to install this modules for jsreport v2{ "name": "jsreport-server", "main": "server.js", "scripts": { "start": "node server", "jsreport": "jsreport" }, "jsreport": { "entryPoint": "server.js" }, "dependencies": { "jsreport": "2.2.0", "jsreport-ejs": "^2.0.0" } }
-
Full log of jsreport when starting the application
C:\source\jsreportapp>jsreport start --verbose resolving jsreport location.. using jsreport instance passed from options starting jsreport.. 2018-09-12T15:17:47.476Z - info: Initializing jsreport@2.2.0 in development mode using configuration file: jsreport.config.json 2018-09-12T15:17:47.529Z - info: Using extension cli 2018-09-12T15:17:47.537Z - info: Using extension handlebars 2018-09-12T15:17:47.539Z - info: Using extension puppeteer-compile 2018-09-12T15:17:47.540Z - info: Using extension authentication 2018-09-12T15:17:47.546Z - debug: Extension authentication was disabled 2018-09-12T15:17:47.547Z - info: Using extension import-export 2018-09-12T15:17:47.549Z - info: Using extension templates 2018-09-12T15:17:47.549Z - info: Using extension freeze 2018-09-12T15:17:47.551Z - info: Using extension debug 2018-09-12T15:17:47.553Z - info: Using extension express 2018-09-12T15:17:47.558Z - info: Using extension tags 2018-09-12T15:17:47.560Z - info: Using extension jsrender 2018-09-12T15:17:47.560Z - info: Using extension data 2018-09-12T15:17:47.561Z - info: Using extension authorization 2018-09-12T15:17:47.563Z - debug: Extension authorization was disabled 2018-09-12T15:17:47.563Z - info: Using extension html-to-xlsx 2018-09-12T15:17:47.566Z - info: html-to-xlsx detected chrome as available html engine 2018-09-12T15:17:47.567Z - info: Using extension chrome-pdf 2018-09-12T15:17:47.571Z - debug: Chrome custom launch options are executablePath=C:\Users\..\AppData\Local\Temp\jsreport\compile\jsreport-2.2.0-r17qQMiI7\chrome\chrome 2018-09-12T15:17:47.572Z - info: Using extension child-templates 2018-09-12T15:17:47.573Z - info: Using extension licensing 2018-09-12T15:17:47.574Z - info: Using extension fs-store 2018-09-12T15:17:47.576Z - info: Using extension version-control 2018-09-12T15:17:47.640Z - info: Using extension browser-client 2018-09-12T15:17:47.642Z - info: Using extension reports 2018-09-12T15:17:47.644Z - info: Using extension text 2018-09-12T15:17:47.645Z - info: Using extension base 2018-09-12T15:17:47.647Z - info: Using extension studio 2018-09-12T15:17:47.650Z - info: Using extension pdf-utils 2018-09-12T15:17:47.652Z - info: Using extension scripts 2018-09-12T15:17:47.659Z - info: Using extension assets 2018-09-12T15:17:47.662Z - info: Using extension scheduling 2018-09-12T15:17:47.666Z - info: Using extension xlsx 2018-09-12T15:17:47.670Z - info: Using extension sample-template 2018-09-12T15:17:47.673Z - debug: Creating samples is disabled 2018-09-12T15:17:47.674Z - info: Using extension resources 2018-09-12T15:17:47.675Z - info: Using extension public-templates 2018-09-12T15:17:47.676Z - debug: Extension public-templates was disabled 2018-09-12T15:17:47.681Z - info: fs store is persisting using fs 2018-09-12T15:17:47.682Z - info: fs store is synchronizing using fs 2018-09-12T15:17:47.722Z - info: fs store is loading data 2018-09-12T15:17:47.797Z - debug: fs store sync is configured to use polling for files watcher 2018-09-12T15:17:48.010Z - info: fs store is initialized successfully 2018-09-12T15:17:50.085Z - info: Creating default express app. 2018-09-12T15:17:50.106Z - info: jsreport server successfully started on http port: 4000 2018-09-12T15:17:50.123Z - info: fs store emits sockets to synchronize underlying changes with studio 2018-09-12T15:17:50.130Z - info: Verifying license key xxxxx 2018-09-12T15:17:50.133Z - info: License key for subscription verified against the jsreport.license.json file 2018-09-12T15:17:50.137Z - info: reporter initialized jsreport successfully started
-
Could you please share also the
server.js
file content?
-
here is file content of server.js
const jsreport = require('jsreport')() if (process.env.JSREPORT_CLI) { // export jsreport instance to make it possible to use jsreport-cli module.exports = jsreport } else { jsreport.init().then(() => { // running }).catch((e) => { // error during startup console.error(e.stack) process.exit(1) }) }
-
hm, that looks normal, that is mystery...
I believe the key will be in this lines
resolving jsreport location.. using jsreport instance passed from options
That is something that should not be there. @bjrmatos will know better what that means.
Maybe as a workaround you can use just this to boot up
node server.js
-
node server.js does not work
C:\source\jsreportapp>node server.js internal/modules/cjs/loader.js:596 throw err; ^ Error: Cannot find module 'node.extend' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15) at Function.Module._load (internal/modules/cjs/loader.js:520:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (C:\source\jsreportapp\node_modules\jsreport\index.js:20:16) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12) at Function.Module._load (internal/modules/cjs/loader.js:543:3)
-
I guess you have very old npm right?
Can you type this?npm --version
I would guess you have something like v2 and you should have something like v6
Can you upgrade it and reinstall jsreport?
-
npm and node versions are up to date
C:\>npm --version 6.4.1 C:\>node --version v10.5.0
-
do i need to configure anything in
jsreport.config.json
file so that it can detect ejs engine?
-
No you don't need any configuration. I tried the latest npm and have no issues on windows.
I would recommend to uninstall node, remove jsreportapp. Reboot and start from scratch.The error you posted
Error: Cannot find module 'node.extend'
should not happen at all if you install jsreport with your npm.
Isn't there any error when callingjsreport init
?
-
turned off npm
legacy-bundling
and it worked. Thanks for the help