Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Hyperledger Composer下的MongoClient.connect在尝试实现JWT身份验证时似乎抛出错误_Node.js_Docker_Hyperledger Fabric_Hyperledger Composer - Fatal编程技术网

Node.js Hyperledger Composer下的MongoClient.connect在尝试实现JWT身份验证时似乎抛出错误

Node.js Hyperledger Composer下的MongoClient.connect在尝试实现JWT身份验证时似乎抛出错误,node.js,docker,hyperledger-fabric,hyperledger-composer,Node.js,Docker,Hyperledger Fabric,Hyperledger Composer,当我按照下面的命令运行时,试图运行docker logs rest它抛出以下错误:我似乎不明白为什么 [2018-12-06 17:17:59] PM2 log: Launching in no daemon mode [2018-12-06 17:17:59] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0 [2018-12-06 17:17:59] PM2 l

当我按照下面的命令运行时,试图运行
docker logs rest
它抛出以下错误:我似乎不明白为什么

[2018-12-06 17:17:59] PM2 log: Launching in no daemon mode
[2018-12-06 17:17:59] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-12-06 17:17:59] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
(node:19) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
预期产出:

docker logs rest
[2018-05-22 22:24:44] PM2 log: Launching in no daemon mode
[2018-05-22 22:24:44] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-05-22 22:24:44] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
Discovered types from business network definition
Generating schemas for all types in business network definition ...
Generated schemas for all types in business network definition
Adding schemas for all types to Loopback ...
Added schemas for all types to Loopback
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
[更新]:

[2018-12-08 04:01:58] PM2 log: Launching in no daemon mode
[2018-12-08 04:01:58] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-12-08 04:01:58] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...

例如,要消除警告消息,需要将警告中指定的选项添加到COMPOSER_DATASOURCES环境变量中

COMPOSER_DATASOURCES='{
   "db": {
     "name": "db", 
     "connector": "mongodb", 
     "host": "mongo", 
     "useNewUrlParser": "true"
   }
}'

上面只包含警告,没有错误消息,没有指示composer rest服务器的实际问题。请提供有关rest服务器问题的详细信息is@david_k谢谢你的留言。我已经加上了期望值。因为当我运行
docker日志rest时,它应该在端口3000启动“explorer”。但是,目前它似乎在抛出警告后立即停止。因此,在谷歌上快速搜索建议将其添加到mongo环回选项中,因此请尝试COMPOSER_DATASOURCES='{“db”:{“name”:“db”,“connector”:“mongodb”,“host”:“mongo”,“useNewUrlParser”:“true”}“谢谢@david_k它删除了错误,但网络仍然不工作。我已经添加了[update],如果你知道如何解决它。但是你可以把它作为一个答案,我会把它标记为一个正确的答案。谢谢