使用Fabric v1.2启动Hyperledger Explorer时出错

时间:2018-09-17 08:08:59

标签: hyperledger-fabric hyperledger-explorer

启动资源管理器时出现以下错误:

<<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>
TypeError: Cannot read property 'size' of undefined
    at Platform.initialize (/home/kp/Desktop/blockchain-explorer/app/platform/fabric/Platform.js:52:45)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
Received kill signal, shutting down gracefully
Closed out connections

使用Fabric v1.2和Explorer v0.3.6我已将grpcs替换为grpc,但这也无济于事。不确定在配置文件中将“ size”属性传递到何处。

{
   "network-configs":{
      "network-1":{
         "version":"1.0",
         "clients":{
            "client-1":{
               "tlsEnable":true,
               "organization":"Org1MSP",
               "channel":"mychannel",
               "credentialStore":{
                  "path":"./tmp/credentialStore_Org1/credential",
                  "cryptoStore":{
                     "path":"./tmp/credentialStore_Org1/crypto"
                  }
               }
            }
         },
         "channels":{
            "mychannel":{
               "peers":{
                  "peer0.org1.example.com":{
              }
           },
           "connection":{
              "timeout":{
                 "peer":{
                    "endorser":"6000",
                    "eventHub":"6000",
                    "eventReg":"6000"
                 }
              }
           }
        }
     },
     "organizations":{
        "Org1MSP":{
           "mspid":"Org1MSP",
           "fullpath":false,
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/"
           },
           "signedCert":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/"
           }
        },
        "Org2MSP":{
           "mspid":"Org2MSP",
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore/"
           }
        },
        "OrdererMSP":{
           "mspid":"OrdererMSP",
           "adminPrivateKey":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore/"
           }
        }
     },
     "peers":{
        "peer0.org1.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:7051",
           "eventUrl":"grpc://localhost:7053",
           "grpcOptions":{
              "ssl-target-name-override":"peer0.org1.example.com"
           }
        },
        "peer1.org1.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:8051",
           "eventUrl":"grpc://localhost:8053",
           "grpcOptions":{
              "ssl-target-name-override":"peer1.org1.example.com"
           }
        },
        "peer0.org2.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:9051",
           "eventUrl":"grpc://localhost:9053",
           "grpcOptions":{
              "ssl-target-name-override":"peer0.org2.example.com"
           }
        },
        "peer1.org2.example.com":{
           "tlsCACerts":{
              "path":"/home/kp/Desktop/bct/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
           },
           "url":"grpc://localhost:10051",
           "eventUrl":"grpc://localhost:10053",
           "grpcOptions":{
              "ssl-target-name-override":"peer1.org2.example.com"
           }
        }
     },
     "orderers":{
        "orderer.example.com":{
           "url":"grpc://localhost:7050"
        }
     }
  },
  "network-2":{

  }

},    “ configtxgenToolPath”:“ / home / kp / Desktop / bct / fabric-samples / bin /”,    “ license”:“ Apache-2.0” }

3 个答案:

答案 0 :(得分:0)

TypeError: Cannot read property 'size' of undefined
at Platform.initialize (/home/kp/Desktop/blockchain-explorer/app/platform/fabric/Platform.js:52:45)

根据Platform.js,这意味着由于某种原因未能加载config.json。您需要使用以下观点进行审查:

  • 检查日志/app/app.log
  • 与原始config.json的区别

我认为这与此问题无关,但是在禁用TLS时,您需要将config.json中的'tlsEnable'更改为'false'。

{
   "network-configs": {
     "network-1": {
       "clients": {
         "client-1": {
           "tlsEnable": false,
                        ^^^^^

答案 1 :(得分:0)

您对此问题有解决方案吗? 我通过链接逐步部署了Hyperledger Explorer https://github.com/hyperledger/blockchain-explorer,我也遇到了相同的错误 我使用fabric v1.2和composer v0.20.0

答案 2 :(得分:0)

我遇到了同样的错误,在我这边的标签“ network-configs”:丢失了。 在控制台日志中,在发生此错误之前,我收到一条消息,提示“ *******为Hyperledger Fabric平台********开始初始化”,未定义

如果您在platform.js中检查了代码,则可以看到未定义的变量对应于network-configs。

我在原始文件夹中创建了一个简单的config.json文件,如下所示:

{

"network-configs": {

    "first-network": {

        "name": "firstnetwork",

        "profile": "./connection-profile/first-network.json",

        "enableAuthentication": false

    }

},

"license": "Apache-2.0"

比起我创建的完整个人资料文档

{

"name": "first-network",

"version": "1.0.0",

我不确定是否真的需要分割文件,但是无论如何,我还是用此程序解决了该问题。