Setting up mongodb storage does not work for me, what seems to be the problem?



  • yes this exact same steps...

    npm install jsreport-cli -g
    mkdir jsreportapp
    cd jsreportapp
    jsreport init
    jsreport configure
    jsreport start
    
    npm i jsreport-mongodb-store
    

    but for the confirmation's sake.. i will try it again now.



  • Yes, please try it in another directory.
    The startup log should look differently.



  • holy cow!! now i got different error, even running the command as administrator

    
    C:\Apps\gitlab.com\pantas.report>npm install jsreport-cli -g
    C:\Users\iamrommel\AppData\Roaming\npm\jsreport -> C:\Users\iamrommel\AppData\Roaming\npm\node_modules\jsreport-cli\cli.js
    + jsreport-cli@2.0.7
    updated 1 package in 16.247s
    
    C:\Apps\gitlab.com\pantas.report>jsreport init
    jsreport installation not found, installing jsreport latest version now, wait a moment...
    Unexpected error happened: Command failed: npm i -S jsreport
    npm ERR! Unexpected end of JSON input while parsing near '..."1.3.1"},"_hasShrinkw'
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\iamrommel\AppData\Roaming\npm-cache\_logs\2019-07-03T09_14_24_370Z-debug.log
     (1).
    caused by error (1) -> meta = {"killed":false,"code":1,"signal":null,"cmd":"npm i -S jsreport"}, stack = Error:
        at ChildProcess.exithandler (child_process.js:275:12)
        at emitTwo (events.js:126:13)
        at ChildProcess.emit (events.js:214:7)
        at maybeClose (internal/child_process.js:925:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    
    C:\Apps\gitlab.com\pantas.report>
    


  • ok.. i will try on different directory, maybe the "." on folder name has issue on it.



  • 0_1562145444923_upload-b9269479-a8a7-45e1-840b-236d0c575030

    Same thing, i cannot even init the jsReport now...



  • i will try

    1. uninstalling the global jsReport-cli
    2. use the local jsREport-CLI (just add it to devDependencies)


  • .....
    361 silly resolveWithNewModule jsreport-data@2.1.0 checking installable status
    362 http fetch GET 304 https://registry.npmjs.org/jsreport-cli 176ms (from cache)
    363 silly pacote version manifest for jsreport-cli@2.0.7 fetched in 179ms
    364 silly resolveWithNewModule jsreport-cli@2.0.7 checking installable status
    365 http fetch GET 304 https://registry.npmjs.org/jsreport-child-templates 186ms (from cache)
    366 http fetch GET 304 https://registry.npmjs.org/jsreport-core 187ms (from cache)
    367 silly fetchPackageMetaData error for jsreport-core@2.5.0 Unexpected end of JSON input while parsing near '..."1.3.1"},"_hasShrinkw'
    368 silly pacote version manifest for jsreport-child-templates@1.2.0 fetched in 192ms
    369 silly resolveWithNewModule jsreport-child-templates@1.2.0 checking installable status
    370 http fetch GET 304 https://registry.npmjs.org/jsreport-authorization 197ms (from cache)
    371 silly pacote version manifest for jsreport-authorization@2.2.4 fetched in 204ms
    372 silly resolveWithNewModule jsreport-authorization@2.2.4 checking installable status
    373 http fetch GET 304 https://registry.npmjs.org/jsreport-freeze 87ms (from cache)
    374 silly pacote version manifest for jsreport-freeze@2.0.0 fetched in 92ms
    375 silly resolveWithNewModule jsreport-freeze@2.0.0 checking installable status
    376 http fetch GET 304 https://registry.npmjs.org/jsreport-fs-store 78ms (from cache)
    377 silly pacote version manifest for jsreport-fs-store@2.4.1 fetched in 80ms
    378 silly resolveWithNewModule jsreport-fs-store@2.4.1 checking installable status
    379 http fetch GET 304 https://registry.npmjs.org/jsreport-html-to-xlsx 56ms (from cache)
    380 silly pacote version manifest for jsreport-html-to-xlsx@2.3.1 fetched in 60ms
    381 silly resolveWithNewModule jsreport-html-to-xlsx@2.3.1 checking installable status
    382 http fetch GET 304 https://registry.npmjs.org/jsreport-debug 148ms (from cache)
    383 silly pacote version manifest for jsreport-debug@2.0.2 fetched in 155ms
    384 silly resolveWithNewModule jsreport-debug@2.0.2 checking installable status
    385 http fetch GET 200 https://registry.npmjs.org/jsreport-resources 24ms (from cache)
    386 silly pacote version manifest for jsreport-resources@2.0.3 fetched in 28ms
    387 silly resolveWithNewModule jsreport-resources@2.0.3 checking installable status
    388 http fetch GET 304 https://registry.npmjs.org/jsreport-licensing 65ms (from cache)
    389 silly pacote version manifest for jsreport-licensing@2.1.0 fetched in 69ms
    390 silly resolveWithNewModule jsreport-licensing@2.1.0 checking installable status
    391 http fetch GET 304 https://registry.npmjs.org/jsreport-public-templates 51ms (from cache)
    392 silly pacote version manifest for jsreport-public-templates@2.0.1 fetched in 59ms
    393 silly resolveWithNewModule jsreport-public-templates@2.0.1 checking installable status
    394 http fetch GET 304 https://registry.npmjs.org/jsreport-jsrender 86ms (from cache)
    395 silly pacote version manifest for jsreport-jsrender@2.0.0 fetched in 89ms
    396 silly resolveWithNewModule jsreport-jsrender@2.0.0 checking installable status
    397 http fetch GET 304 https://registry.npmjs.org/jsreport-reports 71ms (from cache)
    398 silly pacote version manifest for jsreport-reports@2.2.0 fetched in 73ms
    399 silly resolveWithNewModule jsreport-reports@2.2.0 checking installable status
    400 http fetch GET 200 https://registry.npmjs.org/jsreport-templates 12ms (from cache)
    401 silly pacote version manifest for jsreport-templates@2.2.0 fetched in 13ms
    402 silly resolveWithNewModule jsreport-templates@2.2.0 checking installable status
    403 http fetch GET 304 https://registry.npmjs.org/jsreport-scripts 49ms (from cache)
    404 silly pacote version manifest for jsreport-scripts@2.1.0 fetched in 53ms
    405 silly resolveWithNewModule jsreport-scripts@2.1.0 checking installable status
    406 http fetch GET 304 https://registry.npmjs.org/jsreport-pdf-utils 124ms (from cache)
    407 silly pacote version manifest for jsreport-pdf-utils@1.4.0 fetched in 126ms
    408 silly resolveWithNewModule jsreport-pdf-utils@1.4.0 checking installable status
    409 http fetch GET 200 https://registry.npmjs.org/jsreport-version-control 15ms (from cache)
    410 http fetch GET 304 https://registry.npmjs.org/jsreport-studio 61ms (from cache)
    411 silly pacote version manifest for jsreport-version-control@1.2.3 fetched in 48ms
    412 silly resolveWithNewModule jsreport-version-control@1.2.3 checking installable status
    413 silly pacote version manifest for jsreport-studio@2.5.1 fetched in 94ms
    414 silly resolveWithNewModule jsreport-studio@2.5.1 checking installable status
    415 http fetch GET 304 https://registry.npmjs.org/jsreport-tags 96ms (from cache)
    416 silly pacote version manifest for jsreport-tags@2.2.0 fetched in 98ms
    417 silly resolveWithNewModule jsreport-tags@2.2.0 checking installable status
    418 http fetch GET 304 https://registry.npmjs.org/jsreport-text 79ms (from cache)
    419 silly pacote version manifest for jsreport-text@2.0.0 fetched in 81ms
    420 silly resolveWithNewModule jsreport-text@2.0.0 checking installable status
    421 http fetch GET 304 https://registry.npmjs.org/jsreport-xlsx 81ms (from cache)
    422 silly pacote version manifest for jsreport-xlsx@2.0.10 fetched in 85ms
    423 silly resolveWithNewModule jsreport-xlsx@2.0.10 checking installable status
    424 http fetch GET 304 https://registry.npmjs.org/node.extend.without.arrays 49ms (from cache)
    425 silly pacote version manifest for node.extend.without.arrays@1.1.6 fetched in 50ms
    426 silly resolveWithNewModule node.extend.without.arrays@1.1.6 checking installable status
    427 http fetch GET 304 https://registry.npmjs.org/mkdirp 53ms (from cache)
    428 silly pacote version manifest for mkdirp@0.5.1 fetched in 54ms
    429 silly resolveWithNewModule mkdirp@0.5.1 checking installable status
    430 http fetch GET 304 https://registry.npmjs.org/semver 51ms (from cache)
    431 silly pacote version manifest for semver@6.1.0 fetched in 52ms
    432 silly resolveWithNewModule semver@6.1.0 checking installable status
    433 http fetch GET 304 https://registry.npmjs.org/puppeteer 67ms (from cache)
    434 silly pacote version manifest for puppeteer@1.17.0 fetched in 78ms
    435 silly resolveWithNewModule puppeteer@1.17.0 checking installable status
    436 http fetch GET 304 https://registry.npmjs.org/jsreport-express 787ms (from cache)
    437 silly pacote version manifest for jsreport-express@2.4.0 fetched in 789ms
    438 silly resolveWithNewModule jsreport-express@2.4.0 checking installable status
    439 http fetch GET 304 https://registry.npmjs.org/jsreport-handlebars 764ms (from cache)
    440 silly pacote version manifest for jsreport-handlebars@2.0.2 fetched in 767ms
    441 silly resolveWithNewModule jsreport-handlebars@2.0.2 checking installable status
    442 http fetch GET 304 https://registry.npmjs.org/jsreport-import-export 776ms (from cache)
    443 silly pacote version manifest for jsreport-import-export@1.3.0 fetched in 778ms
    444 silly resolveWithNewModule jsreport-import-export@1.3.0 checking installable status
    445 http fetch GET 304 https://registry.npmjs.org/jsreport-sample-template 754ms (from cache)
    446 silly pacote version manifest for jsreport-sample-template@2.3.0 fetched in 756ms
    447 silly resolveWithNewModule jsreport-sample-template@2.3.0 checking installable status
    448 http fetch GET 304 https://registry.npmjs.org/jsreport-scheduling 795ms (from cache)
    449 silly pacote version manifest for jsreport-scheduling@2.0.7 fetched in 798ms
    450 silly resolveWithNewModule jsreport-scheduling@2.0.7 checking installable status
    451 timing stage:rollbackFailedOptional Completed in 1ms
    452 timing stage:runTopLevelLifecycles Completed in 2134ms
    453 silly saveTree pantas.report@1.0.0
    453 silly saveTree +-- jsreport-cli@2.0.7
    453 silly saveTree `-- jsreport@2.5.0
    453 silly saveTree   +-- jsreport-assets@1.1.3
    453 silly saveTree   +-- jsreport-authentication@2.2.3
    453 silly saveTree   +-- jsreport-authorization@2.2.4
    453 silly saveTree   | `-- node.extend.without.arrays@1.1.6
    453 silly saveTree   +-- jsreport-base@2.0.2
    453 silly saveTree   +-- jsreport-browser-client@2.1.1
    453 silly saveTree   +-- jsreport-child-templates@1.2.0
    453 silly saveTree   +-- jsreport-chrome-pdf@1.4.0
    453 silly saveTree   +-- jsreport-data@2.1.0
    453 silly saveTree   +-- jsreport-debug@2.0.2
    453 silly saveTree   +-- jsreport-express@2.4.0
    453 silly saveTree   +-- jsreport-freeze@2.0.0
    453 silly saveTree   +-- jsreport-fs-store@2.4.1
    453 silly saveTree   | `-- mkdirp@0.5.1
    453 silly saveTree   +-- jsreport-handlebars@2.0.2
    453 silly saveTree   +-- jsreport-html-to-xlsx@2.3.1
    453 silly saveTree   +-- jsreport-import-export@1.3.0
    453 silly saveTree   +-- jsreport-jsrender@2.0.0
    453 silly saveTree   +-- jsreport-licensing@2.1.0
    453 silly saveTree   +-- jsreport-pdf-utils@1.4.0
    453 silly saveTree   +-- jsreport-public-templates@2.0.1
    453 silly saveTree   +-- jsreport-reports@2.2.0
    453 silly saveTree   +-- jsreport-resources@2.0.3
    453 silly saveTree   +-- jsreport-sample-template@2.3.0
    453 silly saveTree   +-- jsreport-scheduling@2.0.7
    453 silly saveTree   +-- jsreport-scripts@2.1.0
    453 silly saveTree   +-- jsreport-studio@2.5.1
    453 silly saveTree   +-- jsreport-tags@2.2.0
    453 silly saveTree   +-- jsreport-templates@2.2.0
    453 silly saveTree   +-- jsreport-text@2.0.0
    453 silly saveTree   +-- jsreport-version-control@1.2.3
    453 silly saveTree   +-- jsreport-xlsx@2.0.10
    453 silly saveTree   +-- mkdirp@0.5.1
    453 silly saveTree   +-- node.extend.without.arrays@1.1.6
    453 silly saveTree   +-- puppeteer@1.17.0
    453 silly saveTree   `-- semver@6.1.0
    454 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '..."1.3.1"},"_hasShrinkw'
    454 verbose stack     at JSON.parse (<anonymous>)
    454 verbose stack     at parseJson (C:\Users\iamrommel\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
    454 verbose stack     at consumeBody.call.then.buffer (C:\Users\iamrommel\AppData\Roaming\npm\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
    454 verbose stack     at <anonymous>
    454 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
    455 verbose cwd C:\Apps\gitlab.com\pantas.report
    456 verbose Windows_NT 10.0.17134
    457 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\iamrommel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "-S" "jsreport"
    458 verbose node v8.11.1
    459 verbose npm  v6.9.0
    460 error Unexpected end of JSON input while parsing near '..."1.3.1"},"_hasShrinkw'
    461 verbose exit [ 1, true ]
    
    

    here is npm error log



  • Clearing the NPM cache removes the

    nd of JSON input while parsing near '..."1.3.1"},"_hasShrinkw'
    

    error

    I was able to create jsReport using the cli as descibe here https://jsreport.net/on-prem

    using the jsreport-mongodb-store does not work for me, but the default fs works fine. I was able to create reports and display it properly. By the way i was using mongodb 3.4.10 which i guess is fine, but really this mongo store does not work for me



  • It does not really work!!!

    I tried to use new and fresh environment. Followed the steps as described from https://jsreport.net/on-prem

    npm install jsreport-cli -g
    mkdir jsreportapp
    cd jsreportapp
    jsreport init
    jsreport configure
    npm i jsreport-mongodb-store
    jsreport start
    

    here is the logs

    C:\Apps\jsreport>jsreport start
    2019-07-04T01:52:20.254Z - info: Initializing jsreport@2.5.0 in development mode using configuration file: jsreport.config.json
    2019-07-04T01:52:20.259Z - info: Searching for available extensions in C:\Apps\jsreport\
    2019-07-04T01:52:20.288Z - info: Extensions location cache C:\Users\IAMROM~1\AppData\Local\Temp\jsreport\core\locations.json contains older information, crawling
    2019-07-04T01:52:21.862Z - info: Found 32 extensions
    2019-07-04T01:52:21.893Z - debug: Writing extension locations cache to C:\Users\IAMROM~1\AppData\Local\Temp\jsreport\core\locations.json
    2019-07-04T01:52:21.896Z - debug: Discovered 32 extensions
    2019-07-04T01:52:21.942Z - info: Setting http-server strategy for rendering
    2019-07-04T01:52:22.569Z - info: Using extension handlebars@2.0.2
    2019-07-04T01:52:22.577Z - info: Using extension jsrender@2.0.0
    2019-07-04T01:52:22.578Z - info: Using extension templates@2.2.0
    2019-07-04T01:52:22.583Z - info: Using extension mongodb-store@1.2.2
    2019-07-04T01:52:22.779Z - info: Connecting mongo to mongodb://localhost:27017/pantas
    2019-07-04T01:52:23.831Z - info: Connection successful
    2019-07-04T01:52:23.835Z - info: Using extension authentication@2.2.3
    2019-07-04T01:52:23.895Z - info: Using extension import-export@1.3.0
    2019-07-04T01:52:24.104Z - info: Using extension cli@2.0.7
    2019-07-04T01:52:24.107Z - info: Using extension freeze@2.0.0
    2019-07-04T01:52:24.110Z - info: Using extension debug@2.0.2
    2019-07-04T01:52:24.113Z - info: Using extension express@2.4.0
    2019-07-04T01:52:24.356Z - info: Using extension tags@2.2.0
    2019-07-04T01:52:24.361Z - info: Using extension data@2.1.0
    2019-07-04T01:52:24.364Z - info: Using extension authorization@2.2.4
    2019-07-04T01:52:24.371Z - info: Using extension chrome-pdf@1.4.0
    2019-07-04T01:52:24.485Z - debug: Chrome strategy is dedicated-process
    2019-07-04T01:52:24.488Z - info: Using extension child-templates@1.2.0
    2019-07-04T01:52:24.497Z - info: Using extension licensing@2.1.0
    2019-07-04T01:52:24.552Z - info: Using extension browser-client@2.1.1
    2019-07-04T01:52:24.557Z - info: Using extension fs-store@2.4.1
    2019-07-04T01:52:24.692Z - debug: Extension fs-store@2.4.1 was disabled
    2019-07-04T01:52:24.694Z - info: Using extension version-control@1.2.3
    2019-07-04T01:52:24.821Z - info: Using extension reports@2.2.0
    2019-07-04T01:52:24.830Z - info: Using extension text@2.0.0
    2019-07-04T01:52:24.833Z - info: Using extension base@2.0.2
    2019-07-04T01:52:24.836Z - info: Using extension studio@2.5.1
    2019-07-04T01:52:24.866Z - debug: studio request logs are enabled (flush interval: 2000)
    2019-07-04T01:52:24.868Z - info: Using extension pdf-utils@1.4.0
    2019-07-04T01:52:25.151Z - info: Using extension scheduling@2.0.7
    2019-07-04T01:52:25.210Z - info: Using extension scripts@2.1.0
    2019-07-04T01:52:25.218Z - info: Using extension html-to-xlsx@2.3.1
    2019-07-04T01:52:25.386Z - info: html-to-xlsx detected chrome as available html engine
    2019-07-04T01:52:25.389Z - info: Using extension assets@1.1.3
    2019-07-04T01:52:25.406Z - info: Using extension xlsx@2.0.10
    2019-07-04T01:52:25.659Z - info: Using extension sample-template@2.3.0
    2019-07-04T01:52:25.667Z - info: Using extension resources@2.0.3
    2019-07-04T01:52:25.670Z - info: Using extension public-templates@2.0.1
    2019-07-04T01:52:25.673Z - info: Using mongodb provider for template store.
    2019-07-04T01:52:25.717Z - info: Creating default express app.
    2019-07-04T01:52:25.745Z - info: jsreport server successfully started on http port: 5488
    2019-07-04T01:52:25.749Z - info: Verifying license key free
    2019-07-04T01:52:25.752Z - info: Using free license
    2019-07-04T01:52:25.756Z - debug: Creating samples is disabled
    2019-07-04T01:52:25.758Z - info: reporter initialized
    2019-07-04T01:52:33.741Z - debug: OData query on templates
    2019-07-04T01:52:33.745Z - debug: OData query on folders
    2019-07-04T01:52:33.753Z - debug: OData query on tags
    2019-07-04T01:52:33.754Z - debug: OData query on data
    2019-07-04T01:52:33.756Z - debug: OData query on scripts
    2019-07-04T01:52:33.757Z - debug: OData query on assets
    2019-07-04T01:52:33.762Z - debug: OData query on xlsxTemplates
    2019-07-04T01:52:34.766Z - debug: OData query on users
    2019-07-04T01:52:35.769Z - debug: OData query on schedules
    2019-07-04T01:52:35.780Z - debug: OData query on settings
    
    

    here the config

    {
      "extensions": {
        "authentication": {
          "cookieSession": {
            "secret": "long-text-here"
          },
          "admin": {
            "username": "admin",
            "password": "Abc12345#"
          },
          "enabled": true
        },
        "scripts": {
          "timeout": 40000,
          "strategy": "http-server"
        },
    	"mongodb-store": {
    		"uri": "mongodb://localhost:27017/pantas"
    	}
      },
      "httpPort": 5488,
      "store": {
        "provider": "mongodb"
      },
       
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        }
      },
      "allowLocalFilesAccess": true,
      "templatingEngines": {
        "timeout": 10000,
        "strategy": "http-server"
      },
      "chrome": {
        "timeout": 40000
      }
    }
    

    And here is the screenshot of the result,

    0_1562205275184_upload-8c8fc446-fd70-4192-9ac1-dd6045a01ab5

    jsreport works fine if i'm using FS as store provider, but if i used mongodb, it fails and shows the same red-screen-of-death as shown on the previous image. I tried it with 2.4.0 and same issue
    @jan_blaha , do you have a working sample, because it really does not work and i'm starting to get frustrated



  • I can't replicate it. It works for me with the same steps and the same config.
    Do you do something specific in the studio? Or it just shows error when loading?
    Can you try it in anonymous browser tab with cleared cache?
    Maybe there is something wrong in your mongo, try to run it on empty database.



  • I used different database it and at last it works.

    I found out that my existing database (pantas) has collections named settings and templates similar to the collections that was generated by jsreport. And maybe mongo-db-store is trying to initialize the value that was inside the settings collection but it does not work with the format of mongo-db-store data and so that epic error is showing..

    I highly suggest to have included the collection prefix for jsreport related collections so it wont clash my existing collections for my existing database



  • You can prefix using this config

    {
      "extensions": {
        "mongodb-store": {
          "uri": "...",
          "prefix": "jsreport_"
        }
      }
    }
    


  • ah.. i never thought you could do that...



  • ow.. the document of jsreport-mongodb-store, updates in relation to it.. good job.


Log in to reply
 

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