Hyperledger Explorer配置错误

时间:2018-09-04 21:10:07

标签: hyperledger-fabric hyperledger blockchain hyperledger-explorer

我正在Ubuntu 16.04版虚拟机中配置Hyperledger Explorer,以与基于以下链接的Hyperledger Composer集成:https://github.com/hyperledger/blockchain-explorer/blob/master/README.md

我已经按照github链接完成了配置的所有步骤,包括数据库设置,并修改了config.json文件以使用Hyperledger Fabric示例的第一个网络结构:

  {
  "network-config": {
    "org1": {
      "name": "peerOrg1",
      "mspid": "Org1MSP",
      "peer1": {
        "requests": "grpcs://127.0.0.1:7051",
        "events": "grpcs://127.0.0.1:7053",
        "server-hostname": "peer0.org1.example.com",
        "tls_cacerts":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
      },
      "peer2": {
        "requests": "grpcs://127.0.0.1:8051",
        "events": "grpcs://127.0.0.1:8053",
        "server-hostname": "peer1.org1.example.com",
        "tls_cacerts":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt"
      },
      "admin": {
        "key":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
        "cert":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
      }
    },
    "org2": {
      "name": "peerOrg2",
      "mspid": "Org2MSP",
      "peer1": {
        "requests": "grpcs://127.0.0.1:9051",
        "events": "grpcs://127.0.0.1:9053",
        "server-hostname": "peer0.org2.example.com",
        "tls_cacerts":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
      },
      "peer2": {
        "requests": "grpcs://127.0.0.1:10051",
        "events": "grpcs://127.0.0.1:10053",
        "server-hostname": "peer1.org2.example.com",
        "tls_cacerts":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt"
      },
      "admin": {
        "key":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/keystore",
        "cert":
          "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts"
      }
    }
  },
  "channel": "mychannel",
  "orderers": [
    {
      "mspid": "OrdererMSP",
      "server-hostname": "orderer.example.com",
      "requests": "grpcs://127.0.0.1:7050",
      "tls_cacerts":
        "/home/diogosilva/fabric-dev-servers/fabric-samples/first-network/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt"
    }
  ],
  "keyValueStore": "/tmp/fabric-client-kvs",
  "configtxgenToolPath": "/home/diogosilva/fabric-dev-servers/fabric-samples/bin",
  "SYNC_START_DATE_FORMAT": "YYYY/MM/DD",
  "syncStartDate": "2018/01/01",
  "eventWaitTime": "30000",
  "license": "Apache-2.0",
  "version": "1.1"
}

然后在运行命令时构建Hyperledger Explorer:

npm test -- -u --coverage

最后一次测试将引发以下错误:

RUNS  src/components/View/LandingPage.spec.js
/home/diogosilva/blockchain-explorer/client/node_modules/react-scripts/scripts/test.js:20
  throw err;
  ^ 

TypeError: getBlockActivity is not a function
    at LandingPage.componentDidMount (/home/diogosilva/blockchain-explorer/client/src/components/View/LandingPage.js:136:5)
    at <anonymous>
npm ERR! Test failed.  See above for more details. 

有人知道如何解决此问题吗?

2 个答案:

答案 0 :(得分:4)

我也遇到了同样的问题,并能够如下解决。我只需要在blockchain-explorer-0.3.7.1\client\src\components\View\LandingPage.spec.js文件中放入一个条目:

getBlockActivity:jest.fn(),

在恒定设置中缺少此行。我添加了这一行,对我来说很好。

答案 1 :(得分:1)

可能是config.json文件错误

在composer通道默认的composerchannel中,因此您应将通道名称更改为由mychannel插入的composerchannel,将通信协议grpcs更改为grpc

我希望它能帮助您...