运行sth-comet时如何修复erro?

时间:2019-04-21 02:05:56

标签: fiware fiware-sth-comet

我正在尝试安装和配置STH-Comet,但是遇到困难,无法解决。

我正在遵循现有的教程。在此过程中会发生一些错误。如果可以的话,请您帮忙。

克隆存储库并进入目录后,当我运行命令:npm install时,会发生两种情况:

1-如果不是root用户,则会显示错误:

enter image description here

2-如果它是root,则错误增加,它们是:

enter image description here

我还尝试通过rpm安装和配置。我没有上述错误,但是当我运行./bin/sth时,出现以下错误。

`` `/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)` ``

我该如何解决?

1 个答案:

答案 0 :(得分:0)

在有帮助的情况下,让我分享我遵循的程序。

  • 已在CentOS 7.5.1804系统中完成。
  • 假设MongoDB已在该系统中启动并运行。
  • 所有命令均以非特权用户身份运行(即,我不是root用户)

节点环境(通过nvm安装):

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

首先,下载代码:

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

然后,安装软件包:

cd fiware-sth-comet
npm install

接下来,编辑config.js以配置STH(有关此文件的详细信息,请查看STH)。我从存储库中按原样使用了config.js

最后,运行服务:

npm start

如果日志显示类似这样的消息,则表明它已正确启动:

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

您可以通过“虚拟”请求检查它是否正在运行。例如:

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'
相关问题