jsreport installation error.



  • Hi,

    I have upgraded the jsreport to latest version as per the steps provided in the site.
    Now I am getting the below error:
    0_1527692075367_upload-df9db210-5a52-46a8-be5c-04ad57323188

    Could you please help me in this regard.


  • administrators

    hi, the steps that you followed are the ones that involve jsreport-migration cli, right? or something else?

    can you show the output of jsreport -v command?

    and also, can you show the content of your package.json file?



  • yes. it is for cli.

    F:\jsReportServer>jsreport -v
    jsreport version: 2.0.0
    cli version: 2.0.2

    Contents of package.json file:

    {
    "name": "jsreport-server",
    "main": "server.js",
    "scripts": {
    "start": "node server",
    "jsreport": "jsreport"
    },
    "jsreport": {
    "entryPoint": "server.js"
    },
    "dependencies": {
    "ajv": "^6.0.0",
    "jsreport": "^2.0.0",
    "jsreport-chrome-pdf": "^1.0.2",
    "jsreport-core": "^2.0.1",
    "jsreport-handlebars": "^2.0.0",
    "jsreport-phantom-pdf": "^2.0.1",
    "npm": "^6.1.0",
    "npm-conf": "^1.1.3",
    "webpack": "^3.0.0"
    }
    }


  • administrators

    what is the content of server.js? jsreport-cli needs some hints in order to work, since you are coming from a migration maybe your server.js contain an old version that does not setup everything correctly for the cli



  • 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)
    })
    }


  • administrators

    hmm it looks good, so i'm not sure what is happening. any reason why you have jsreport-core and jsreport installed in the same project? if you are not using jsreport-core explicetly it will be better to uninstall it, the jsreport-cli checks the presence of jsreport or jsreport-core packages so there is a chance that there is a bug when having the two in same project. my advice is to remove jsreport-core from your project if you are not explicetly requiring that package, then delete your node_modules folder and run a fresh npm install again, then try the jsreport cli again.

    also a note: jsreport init is used to start new projects, usually from a empty directory, when you use it in a project that has been setup previously (like your case, because the migration) it will just print Initialized in console and do nothing if all initial files (server.js, package.json, etc) are already in directory.



  • I removed the jsreport-core. Removed node_modules and ran fresh npm install.
    But no luck.

    If I want to forego this installation and start with fresh installation, what I need to do. Could you provide me steps please.


  • administrators

    this should work:

    • create new empty directory
    • cd to that new directory
    • run jsreport init in that new directory (it will take a while because it will install deps, etc)

    I removed the jsreport-core. Removed node_modules and ran fresh npm install.
    But no luck.

    if you are ok, i can also try to check your project and try to see what can be the bug that makes the jsreport init throw error, i just need that you upload the code on a github repository or send me a zip of your project (without node_modules) at bjrmatos@gmail.com. that is another option if you want to know why it does not work in your current project.



  • It worked. Thank you.


Log in to reply
 

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