Upgrading jsreport to v2 errors out



  • I installed jsreport-cli globally using "npm install jsreport-cli -g". However its looking for jsreport-cli in C:\source\node_module. I don't know why.
    Here is the full output
    C:\source\jsreportapp>jsreport start
    Couldn't find a jsreport installation necessary to check if the command is available, if the command is a valid one try to install jsreport first. (1).
    caused by error (1) -> stack = Error:
    at Promise (C:\source\node_modules\jsreport-cli\lib\instanceHandler.js:50:21)
    at new Promise (<anonymous>)
    at Object.find (C:\source\node_modules\jsreport-cli\lib\instanceHandler.js:42:10)
    at getInstance (C:\source\node_modules\jsreport-cli\lib\commander.js:767:10)
    at exports.handler (C:\source\node_modules\jsreport-cli\lib\commands\start.js:56:5)
    at Commander.executeCommand (C:\source\node_modules\jsreport-cli\lib\commander.js:388:28)
    at Object.handler (C:\source\node_modules\jsreport-cli\lib\commander.js:558:16)
    at Object.self.runCommand (C:\source\node_modules\jsreport-cli\node_modules\yargs\lib\command.js:170:22)
    at parseArgs (C:\source\node_modules\jsreport-cli\node_modules\yargs\yargs.js:920:28)
    at Object.Yargs.self.parse (C:\source\node_modules\jsreport-cli\node_modules\yargs\yargs.js:499:18)



  • please paste the output of previous commands
    Do you see node_modules/jsreport directory created?

    Can you post the output of jsreport init? Is the node_modules/jsreport folder created afterwards.



  • Yes, jsreport init install node_modules and related configs and package files in jsreportapp folder. I reinstalled jsreport-cli globally. When I start jsreport server, I see this error. I used jsreport -h and it turned out that start, win-install ... commands are not even available. npm install jsreport-cli -g installs jsreport version 2.0.3

    "start" command not found in this installation, check that you are writing the command correctly or check if the command is available in your installation, use "jsreport -h" to see the list of available commands

    Commands:
      help       Prints information about a command or topic
      init       Initializes the current working directory to start a jsreport
                 application (server.js, *.config.json and package.json)
      repair     Repairs current working directory to start a jsreport application
                 (server.js, *.config.json and package.json)
      configure  Generates a jsreport configuration file (*.config.json) based on
                 some questions
      render     Invoke a rendering process
    
    Options:
      --help, -h       Show help                                           [boolean]
      --version, -v    Show version number                                 [boolean]
      --verbose, -b    Enables verbose mode                                [boolean]
      --serverUrl, -s  Specifies a url to a remote jsreport server, that server will
                       be the target of the command (only if command support this
                       mode)                                                [string]
      --user, -u       Specifies a username for authentication against a jsreport
                       server (Use if some command needs authentication information)
                                                                            [string]
      --password, -p   Specifies a password for authentication against a jsreport
                       server (Use if some command needs authentication information)
    


  • This post is deleted!


  • Just found out that when I use jsreport start locally from .bin direcotry, I see "start" option. However when I call it globally using jsreport start, command is unavailable. Please help!!


  • administrators

    hmm according to the error message the cli is not able to find that your directory has jsreport installed, probably the code is getting into some conflict trying to get the correct paths. can you please paste here what is the location of the globally installed cli? i think you can do this in windows to find out which jsreport. also please paste here your project path (i guess it is C:\source\jsreportapp). maybe the global cli and the project path share the same root directory and somehow there is some conflict with that.

    something you can try is to run with the locally installed cli, by using npx jsreport start or node node_modules/.bin/jsreport start



  • Initially, globally installed cli was getting installed in users folder i.e. C:\Users\..\AppData\Roaming\npm. I changed the global location to C:\source\npm\ folder. In both cases, it's not working. This is the current location of globally installed cli

    C:\source\npm\jsreport
    C:\source\npm\jsreport.cmd
    

    My project path is C:\source\jsreportapp


  • administrators

    hmm not sure what happens but it seems to me that the problem is related to having the global modules and the project app sharing the same root location or some permissions error that is not shown, the issue needs debugging with your same folders so i'm not sure we will be able to replicate the problem.

    as a last resource, what is the output of jsreport start --verbose, share all the logs printed maybe there is some information there that can be helpful



  • Here is the output of jsreport start --verbose

    C:\>jsreport start --verbose
    "start" command not found in this installation, check that you are writing the command correctly or check if the command is available in your installation, use "jsreport -h" to see the list of available commands


  • What is your nodejs version? Try it out with the LTS one. https://nodejs.org
    I mean try to uninstall everything and try again.
    You still didn't posted the output of jsreport init. It could be interesting.



  • just downgraded to LTS version. Still seeing same issue, jsreport start and other cli commands are unavailable. Any how, i executed jsreport init script. Here is the output

    C:\source\jsreportapp>jsreport init --verbose
    jsreport installation not found, installing jsreport latest version now, wait a moment...
    jsreport installation finished..
    Creating server.js
    Creating package.json
    Creating default config jsreport.config.json
    Initialized
    

    Node and npm versions

    C:\>node --version
    v8.12.0
    C:\>npm --version
    6.4.1


  • Hm. That looks good. Can you zip the jsreportapp an upload it somewhere?





  • Why do you have in that folder jsreport.exe?



  • i added jsreport.exe because jsreport start does not work with jsreport-cli (an issue stated above). When i use jsreport.exe start, i am able to start the server



  • The structure of node_modules isn't flattened. This is not the way how the npm installs it by default.
    This is the way how npm v2 installs modules. Haven't you done any configuration to the npm?

    I would recommend to delete package-lock.json, node_modules and jsreport.exe.

    Then type npm install . The jsreport start should work afterwards. If you have properly working npm.



  • Thank you for your help. I turned off npm legacy-bundling and it worked!!


Log in to reply
 

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