hyperledger-fabric“编写你的第一个应用程序”query.js步骤失败

时间:2017-07-18 18:02:23

标签: node.js hyperledger-fabric

步骤“git clone ...”,“startFabric.sh”和“npm.install”完成且没有错误。 “node query.js”结果为:

    Set wallet path, and associate user  PeerAdmin  with application
    error: [Client.js]: Failed to load user "PeerAdmin" from local key value store. Error: TypeError: this is not a typed array.
      at Function.from (native)
      at importKey (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:180:26)
      at fromString (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/User.js:228:28)
      at /home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:968:22
    error: [Client.js]: Failed to load an instance of requested user "PeerAdmin" from the state store on this Client instance. Error: TypeError: this is not a typed array.
      at Function.from (native)
      at importKey (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:180:26)
      at fromString (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/User.js:228:28)
      at /home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:968:22
   Caught Error [TypeError: this is not a typed array.]

注意:在git clone步骤之后,如文档中所述,fabric-samples / fabcar中没有“chaincode”,但在fabric-samples中有一个chaincode / fabcar。这似乎不会导致问题。 注意:“构建您的第一个网络”中的所有步骤都没有问题。

1 个答案:

答案 0 :(得分:2)

Hyperledger Fabric 1.0已经针对Node.js版本> = 6.9和< 7.x版本如果您收到类似的错误,建议更新Node.js的版本(或使用版本管理器,如nvm)并重试。如果您已使用旧版本的Node运行var object = [{"id":1,"name":"a","childNodes":[{"id":11,"name":"aa","childNodes":[{"id":111,"name":"aaaa","childNodes":[]}]}]},{"id":2,"name":"a","childNodes":[{"id":22,"name":"aa","childNodes":[{"id":123,"name":"aaaa","childNodes":[]}]}]}] function findById(data, id) { for(var i in data) { var result; if(data.id == id) return data if(typeof data[i] == 'object' && (result = findById(data[i], id))) return result } } console.log(findById(object, 111)) console.log(findById(object, 22)),则应删除node_modules树并重新运行npm install以确保安装正确的依赖项。