Can not start server - TypeError: Cannot read property 'cwd' of undefined - urgent



  • It is weird. I have deleted /tmp/jsreport/core/locations.json for serveral times but still can not start.

    ~ > jsreport start
    2018-01-23T22:06:46.263Z - info: Initializing jsreport@1.9.2 in development mode using configuration file: jsreport.config.json
    2018-01-23T22:06:46.265Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
    2018-01-23T22:06:46.266Z - info: Searching for available extensions in /home/user/
    2018-01-23T22:06:46.268Z - info: Extensions location cache not found, crawling directories
    ^[[A^C
    ~ > jsreport start
    2018-01-23T22:07:35.747Z - info: Initializing jsreport@1.9.2 in development mode using configuration file: jsreport.config.json
    2018-01-23T22:07:35.748Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
    2018-01-23T22:07:35.750Z - info: Searching for available extensions in /home/user/
    2018-01-23T22:07:35.751Z - info: Extensions location cache not found, crawling directories

    I deleted all log files then the newly one is empty no matter how many times I try to start the server.


  • administrators

    when starting the server, in which part the error happens? are you waiting until the error happen? or are you just killing the process when getting stuck at info: Extensions location cache not found, crawling directories log?



  • Just because it seems stuck at ..crawling without any further progress for some minutes so I killed the process. Now I let one console going on. What is the maximum crawling time? My PC is fast CPU and using SSD.


  • administrators

    ok, i just needed some confirmation that you were killing the process..

    according to logs it seems that your app is located at /home/user/ or /home/trung/, those seems os level home directories so by nature those directories can contain a lot of files and since jsreport do some crawling to find installed extensions doing that search at a home directory is super intensitive. can you please move your project to /home/user/myjsreportproject and try again? doing that will make the crawling of directories a lot more faster because jsreport won't look at the root level of /home/user



  • Do you mean to remove jsreport from the root dir level then install it again to a sub folder /home/user/myjsreportproject ?
    Do I need to move the /data folder into /home/user/myjsreportproject then re-install the server there?


  • administrators

    Do you mean to remove jsreport from the root dir level then install it again to a sub folder /home/user/myjsreportproject ?

    yes

    Do I need to move the /data folder into /home/user/myjsreportproject then re-install the server there?

    yes, move all your files at /data (because there is where there are all of your templates, etc), and re-install in the new place



  • Now, installed in the new folder then I still got error:

    myjsreport > jsreport start
    2018-01-23T22:38:40.434Z - info: Initializing jsreport@1.9.2 in development mode using configuration file: jsreport.config.json
    2018-01-23T22:38:40.436Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
    2018-01-23T22:38:40.437Z - info: Searching for available extensions in /home/trung/myjsreport/
    2018-01-23T22:38:40.439Z - info: Extensions location cache not found, crawling directories
    2018-01-23T22:38:40.550Z - info: Found 30 extensions
    2018-01-23T22:38:40.556Z - debug: Writing extension locations cache to /tmp/jsreport/core/locations.json
    2018-01-23T22:38:40.557Z - debug: Discovered 30 extensions
    2018-01-23T22:38:40.557Z - info: Using extension import-export
    2018-01-23T22:38:40.645Z - info: Using extension tags
    2018-01-23T22:38:40.647Z - info: Using extension templates
    2018-01-23T22:38:40.648Z - info: Using extension jsrender
    2018-01-23T22:38:40.649Z - debug: Extension authentication is disabled, skipping
    2018-01-23T22:38:40.649Z - info: Using extension cli
    2018-01-23T22:38:40.649Z - info: Using extension handlebars
    2018-01-23T22:38:40.650Z - info: Using extension debug
    2018-01-23T22:38:40.650Z - info: Using extension express
    2018-01-23T22:38:40.688Z - info: Using extension fop-pdf
    2018-01-23T22:38:40.691Z - info: Using extension phantom-pdf
    2018-01-23T22:38:40.721Z - info: Using extension fs-store
    2018-01-23T22:38:40.814Z - info: Using extension authorization
    2018-01-23T22:38:40.814Z - debug: Extension authorization was disabled
    2018-01-23T22:38:40.814Z - info: Using extension images
    2018-01-23T22:38:40.816Z - info: Using extension child-templates
    2018-01-23T22:38:40.817Z - info: Using extension browser-client
    2018-01-23T22:38:40.817Z - info: Using extension licensing
    2018-01-23T22:38:40.831Z - info: Using extension data
    2018-01-23T22:38:40.832Z - info: Using extension text
    2018-01-23T22:38:40.832Z - info: Using extension reports
    2018-01-23T22:38:40.833Z - info: Using extension resources
    2018-01-23T22:38:40.834Z - info: Using extension base
    2018-01-23T22:38:40.834Z - info: Using extension studio
    2018-01-23T22:38:40.869Z - info: Using extension html-to-xlsx
    2018-01-23T22:38:40.897Z - info: Using extension scripts
    2018-01-23T22:38:40.898Z - info: Using extension assets
    2018-01-23T22:38:40.901Z - info: Using extension scheduling
    2018-01-23T22:38:40.940Z - info: Using extension xlsx
    2018-01-23T22:38:41.010Z - info: Using extension sample-template
    2018-01-23T22:38:41.010Z - info: Using extension public-templates
    2018-01-23T22:38:41.012Z - debug: Extension public-templates was disabled
    2018-01-23T22:38:41.013Z - info: Initializing fs storage at /home/trung/myjsreport/data
    2018-01-23T22:38:41.093Z - error: Failed to load collection settings Error: More than 10% of the data file is corrupt, the wrong beforeDeserialization hook may be used. Cautiously refusing to start NeDB to prevent dataloss
    at Persistence.treatRawData (/home/trung/myjsreport/node_modules/nedb/lib/persistence.js:242:11)
    at /home/trung/myjsreport/node_modules/nedb/lib/persistence.js:281:38
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
    2018-01-23T22:38:41.094Z - error: Error occured during reporter init Error: More than 10% of the data file is corrupt, the wrong beforeDeserialization hook may be used. Cautiously refusing to start NeDB to prevent dataloss
    at Persistence.treatRawData (/home/trung/myjsreport/node_modules/nedb/lib/persistence.js:242:11)
    at /home/trung/myjsreport/node_modules/nedb/lib/persistence.js:281:38
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
    Error: An error has occurred when trying to initialize jsreport..
    at /home/trung/myjsreport/node_modules/jsreport-cli/lib/instanceHandler.js:31:23
    at tryCatcher (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/home/trung/myjsreport/node_modules/jsreport-core/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5) {"originalError":{"cause":{},"isOperational":true}}
    (Original) Error: More than 10% of the data file is corrupt, the wrong beforeDeserialization hook may be used. Cautiously refusing to start NeDB to prevent dataloss
    at Persistence.treatRawData (/home/trung/myjsreport/node_modules/nedb/lib/persistence.js:242:11)
    at /home/trung/myjsreport/node_modules/nedb/lib/persistence.js:281:38
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3) {"cause":{},"isOperational":true}



  • As with previous resolution when I got error: error: Failed to load collection settings Error: More than 10% of the data file is corrupt, .I backed up /data/settings file then delete it then the server can start. However, I got another error when try to Run the report within localhost:5488

    Error occured - Error during rendering report: Unsupported module in scripts: http. To enable require on particular module, you need to update the configuration as {"scripts": { "allowedModules": ["http"] } } ... Alternatively you can also set "*" to allowedModules to enable everything
    Stak - /home/trung/myjsreport/node_modules/jsreport-scripts/lib/scriptEvalChild.js:44
    throw new Error('Unsupported module in scripts: ' + moduleName + '. To enable require on particular module, you need to update the configuration as ' +
    ^

    Error: Unsupported module in scripts: http. To enable require on particular module, you need to update the configuration as {"scripts": { "allowedModules": ["http"] } } ... Alternatively you can also set "*" to allowedModules to enable everything
    at _require (/home/trung/myjsreport/node_modules/jsreport-scripts/lib/scriptEvalChild.js:44:11)
    at evalmachine.<anonymous>:2:12
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at ContextifyScript.Script.runInNewContext (vm.js:65:15)
    at Object.runInNewContext (vm.js:135:38)
    at module.exports (/home/trung/myjsreport/node_modules/jsreport-scripts/lib/scriptEvalChild.js:123:6)
    at process.<anonymous> (/home/trung/myjsreport/node_modules/script-manager/lib/worker-processes.js:48:36)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)


  • administrators

    As with previous resolution when I got error: error: Failed to load collection settings Error: More than 10% of the data file is corrupt, .I backed up /data/settings file then delete it then the server can start.

    yes, i was about to recommend you to do that.

    However, I got another error when try to Run the report within localhost:5488
    Error occured - Error during rendering report: Unsupported module in scripts: http. To enable require on particular module, you need to update the configuration as {"scripts": { "allowedModules": ["http"] } } ... Alternatively you can also set "*" to allowedModules to enable everything
    Stak - /home/trung/myjsreport/node_modules/jsreport-scripts/lib/scriptEvalChild.js:44
    throw new Error('Unsupported module in scripts: ' + moduleName + '. To enable require on particular module, you need to update the configuration as ' +

    yes, as the error says, you need to update your configuration file to have something like this:

    {
    // ...other config..
    "tasks": {
    //...other config..
    allowedModules: '*'
    //...other config..
    }
    ...other config
    }
    

  • administrators

    sorry the right config is this:

    {
    // ...other config..
    "scripts": {
    //...other config..
    "allowedModules": "*"
    //...other config..
    }
    //...other config
    }
    

    just ignore the ...other config comments, i just place them to represent that you can place other config there too.



  • Yey, now it works again. Thanks a lot for your help.


  • administrators

    for the record, can you please send me the corrupted /data/settings file at bjrmatos@gmail.com? i would like to check what part if corrupted and if we can do anything about it.



  • Ok sure. The file was sent. Thanks again. Hopefull It would not happen again. This time we are not lucky during the demo to our customer.


  • administrators

    Thanks


Log in to reply
 

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