fiwarefiware-sth-comet

How to fix erro while running sth-comet?


I am trying to install and configure STH-Comet, but I am having difficulties and I could not solve it.

I'm following the existing tutorial. And some errors occur in the process. I would like your help if possible.

After cloning the repository and entering the directory, when I run the command: npm install, two situations occur:

1- If it is not as root the errors are presented:

enter image description here

2 - If it is as root the errors increase, they are:

enter image description here

I also tried to install and configure via rpm. I do not have the above errors, but when I run ./bin/sth the following error appears.

`` `/opt/sth/node_modules/logops/lib/logops.js:27
  let opts = merge({
      ^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/opt/sth/lib/sth.js:27:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)` ``

How can I solve this?


Solution

  • Let me share the procedure I follow, in the case it helps.

    Node environment (installed through nvm):

    $ node --version
    v8.15.1
    $ npm --version
    6.4.1
    

    First, download the code:

    git clone https://github.com/telefonicaid/fiware-sth-comet.git
    

    Then, install packages:

    cd fiware-sth-comet
    npm install
    

    Next, edit config.js to configure STH (look STH for details about this file). I have used config.js "as is" from the repository.

    Finally, run the service:

    npm start
    

    If log shows a message like this, then it has been started correctly:

    time=2019-04-29T20:12:18.745Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_START | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Server started at http://localhost:8666
    

    You can check it's running with a "dummy" request. For instance:

    curl -H 'fiware-service: foo' -H 'fiware-servicepath: bar' 'localhost:8666/STH/v1/contextEntities/type/myType/id/myEntity/attributes/temperature?hLimit=3&hOffset=0&dateFrom=2017-10-16T00:00:00.000Z&dateTo=2017-10-26T23:59:59.999Z'