Hyperledger Fabric-商业用纸教程-链码实例化错误

时间:2019-02-08 12:04:10

标签: docker npm hyperledger-fabric

我一直在关注https://hyperledger-fabric.readthedocs.io/en/release-1.4/tutorial/commercial_paper.html

中的商业论文教程

当我通过运行以下命令实例化链码时

docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract -v 0 -l node -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"

几分钟后出现以下错误

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg timeout expired while starting chaincode papercontract:0 for transaction

我一直在挖掘一点,看来“ dev-peer0.org1.example.com-papercontract-0”失败了

dev-peer0.org1.example.com-papercontract-0日志显示以下内容:

dev-peer0.org1.example.com-papercontract-0|npm ERR! path /usr/local/src/package.json
dev-peer0.org1.example.com-papercontract-0|npm ERR! code ENOENT
dev-peer0.org1.example.com-papercontract-0|npm ERR! errno -2
dev-peer0.org1.example.com-papercontract-0|npm ERR! syscall open
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/src/package.json'
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent This is related to npm not being able to find a file.
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent 
dev-peer0.org1.example.com-papercontract-0|
dev-peer0.org1.example.com-papercontract-0|npm ERR! A complete log of this run can be found in:
dev-peer0.org1.example.com-papercontract-0|npm ERR!     /root/.npm/_logs/2019-02-08T11_51_20_601Z-debug.log

已经坚持了两天,将不胜感激!

编辑:在此之前的步骤按预期顺利进行。 同样,第一个网络仿真(./byfn.sh up)运行得很好。

1 个答案:

答案 0 :(得分:0)

您需要在chaincode目录内的package.json。例如,chaincode目录名称为:./Chaincode,内部应为chaincode.js和package.json。 首先,在package.json中的脚本中,放置“节点chaincode.js”。那是因为对等方使用npm开始执行链码。