找不到newEventHub函数 [英] unable to find newEventHub function

查看:138
本文介绍了找不到newEventHub函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Hyperledger面料的新手.我已经下载了Fabric v1.2.0,并且尝试从fabric-sample文件夹运行fabcar示例.我对chaincode的查询进行得很好,但是当我尝试调用chaincode时,我从cmd中收到以下错误.

I am new to hyperledger fabric. I have downloaded the fabric v1.2.0 and I tried to run fabcar example from the fabric-sample folder. My querying on the chaincode went well, but when I tried to invoke the chaincode I got the below error from the cmd.

这是我对锁码的要求

var request = {
    //targets: let default to the peer assigned to the client
    chaincodeId: 'fabcar',
    fcn: 'changeCarOwner',
    args: ['CAR4', 'Dave'],
    chainId: 'mychannel',
    txId: tx_id
};

错误:

无法成功调用:: TypeError:fabric_client.newEventHub不是函数

Failed to invoke successfully :: TypeError: fabric_client.newEventHub is not a function

当我尝试在 index.t.ds 中找到newEventHub时,找不到该函数.有人可以帮我吗.谢谢.

When I tried to find newEventHub in index.t.ds, I could not find the function. Can anyone help me with this.Thanks in advance.

推荐答案

我认为他们已将EventHub类替换为 ChannelEventHub .

I think they've replaced the EventHub class with ChannelEventHub.

您可以使用以下命令更新invoke.js文件:

You can update the invoke.js file with following:

第105行:

let event_hub = channel.newChannelEventHub('localhost:7051');
// event_hub.setPeerAddr('grpc://localhost:7053');

第130行:

console.log('The transaction has been committed on peer ' + event_hub.getPeerAddr());

那应该解决它.

这篇关于找不到newEventHub函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆