在“编写第一个应用程序”官方部分中调用“ invoke.js”失败

时间:2018-08-07 09:02:19

标签: hyperledger-fabric

每个人

我遵循Hyperledger Fabric v1.2文档来构建fabcar应用程序。

可以成功建立并查询网络。 但是,当我调用“ node invoke.js”时,会弹出以下错误。

Successfully loaded user1 from persistence
Assigning transaction_id:  a9a75de658c14f487d8a57b110d472d2b73471e24af0fa95159048ec39ae7242
Transaction proposal was good
Successfully sent Proposal and received ProposalResponse: Status - 200, message - ""
Failed to invoke successfully :: TypeError: fabric_client.newEventHub is not a function

通过对相关问题的搜索,我将grpc版本修复为1.9.1,但没有解决。

这是我更新的package.json文件。

  1 {
  2     "name": "fabcar",
  3     "version": "1.0.0",
  4     "description": "Hyperledger Fabric Car Sample Application",
  5     "main": "fabcar.js",
  6     "scripts": {
  7         "test": "echo \"Error: no test specified\" && exit 1"
  8     },
  9     "dependencies": {
 10         "fabric-ca-client": "unstable",
 11         "fabric-client": "unstable",
 12         "grpc": "1.9.1"
 13     },
 14     "author": "Anthony O'Dowd",
 15     "license": "Apache-2.0",
 16     "keywords": [
 17         "Hyperledger",
 18         "Fabric",
 19         "Car",
 20         "Sample",
 21         "Application"
 22     ]
 23 }

有解决这个问题的主意吗?我猜应该与版本问题有关。

1 个答案:

答案 0 :(得分:1)

这是与Fabric客户端不匹配的版本。 EventHub在版本1.1.0中已弃用,并在v1.2.0中已删除。要解决此问题(直到我提交并合并对示例的正式修订),请按如下所示更改fabcar/package.json文件并重新运行{{1 }}安装npm installfabric-client软件包的v1.2.1:

fabric-ca-client