我正试图获得第一个演示“编写你的第一个应用程序”app.html在超级分类账织物。我成功地运行了查询部分(queryAllCars和queryCar方法)。我在更新分类账部件方面有问题。我就是这么做的:
存储path:/home/krystian/hyperledger-test/fabric-samples/fabcar/hfc-key-store 成功地从持久性加载user1 赋值0dfca05d6f19187275c6a31febc81429ddca3a284fd590c631961a10f8da5aee :transaction_id 交易提案很好 成功发送建议书并收到ProposalResponse: Stat-200,message - "“ 未能成功调用 ::failed: eventhub ::14 不可用: TCP写失败 (/home/krystian/hyperledger-test/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:64:15) at ClientDuplexStream._emitStatusIfDone (/home/krystian/hyperledger-test/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:270:19) at ClientDuplexStream._receiveStatus (/home/krystian/hyperledger-test/fabric-samples/fabcar/node_modules/fabric-client/node_modules/在/home/krystian/hyperledger-test/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/client.js:804:12上:248:8)
这是我的package.json
{
"name": "fabcar",
"version": "1.0.0",
"description": "Hyperledger Fabric Car Sample Application",
"main": "fabcar.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"fabric-ca-client": "^1.2.1",
"fabric-client": "^1.2.1",
"grpc": "^1.15.1"
},
"author": "Anthony O'Dowd",
"license": "Apache-2.0",
"keywords": [
"Hyperledger",
"Fabric",
"Car",
"Sample",
"Application"
]}
这是invoke.js的一部分,它崩溃了:
let event_hub = fabric_client.newEventHub();
event_hub.setPeerAddr('grpc://localhost:7053');
// using resolve the promise so that result status may be processed
// under the then clause rather than having the catch clause process
// the status
let txPromise = new Promise((resolve, reject) => {
let handle = setTimeout(() => {
event_hub.disconnect();
resolve({event_status : 'TIMEOUT'}); //we could use reject(new Error('Trnasaction did not complete within 30 seconds'));
}, 3000);
**event_hub.connect();
event_hub.registerTxEvent(transaction_id_string, (tx, code) => {
// this is the callback for transaction event status
// first some clean up of event listener
clearTimeout(handle);
event_hub.unregisterTxEvent(transaction_id_string);**
event_hub.disconnect();我尝试删除fabcar/node_模块并再次运行npm安装。我也尝试过运行sudo节点invoke.js。我完成了教程构建你的第一个网络,一切都很好。
节点版本v8.9.0
NPM版本5.5.1
我在使用Linux
当initLedger方法和查询没有问题的时候,更新分类帐的问题在哪里?
发布于 2018-10-23 08:00:49
我又一次犯了这个错误,我终于解决了这个问题。在grpc版本中,这是不匹配的。我以前有Hyperledger网络v1.3.0,它使用grpc@1.14.2,我的客户端应用程序在package.json文件中设置了Fabric的1.1.0和v1.6.6grpc。
在修正了另一个错误之后:
未能成功调用::TypeError: fabric_client.newEventHub不是函数
但是这个错误在这里解决了:unable to find newEventHub function。
因此,如果您有相同的问题,您必须使用相同版本的软件包在网络和客户端应用程序。
https://stackoverflow.com/questions/52704043
复制相似问题