简体   繁体   中英

Hyperledger Fabric - Commercial Paper tutorial - chaincode instantiate error

I have been following the Commercial Paper tutorial from https://hyperledger-fabric.readthedocs.io/en/release-1.4/tutorial/commercial_paper.html

When I instantiate the chaincode by running the following command

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

I get the following error after a few minutes

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

I have been digging down a bit and it seem the "dev-peer0.org1.example.com-papercontract-0" is failing

dev-peer0.org1.example.com-papercontract-0 logs show the following:

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

Have been stuck at it for two days, any help would be greatly appreciated!

Edit: The steps before this run smoothly as expected. Also the first network simulation (./byfn.sh up) runs perfectly fine.

You need the package.json inside the directory of the chaincode. For example, the chaincode directory name is: ./Chaincode , and inside should be chaincode.js and package.json. In the package.json, on start, in script you should put "node chaincode.js". That because the peer use npm start to execute the chaincode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM