I'm trying to install and instantiate chaincode in a hyperledger fabric network setup by me. I've written the chaincode in node.js and it installs perfectly from bash of cli container. But when I try to instantiate the chaincode it gives error after 5 minutes of wait. When I check the log of the short lived chaincode container which has exited after a few seconds I see just one line: npm ERR! missing script: start.
When I first got this error I had not included the start script in package.json and realised my mistake immediately. I included start script in package.json but I'm still getting this error after several retries. I've restarted network several times and pruned docker volumes aswell.
Why this error and how to resolve it?
Here's installation and instantiation(with error):
$ docker exec -it cli bash
root@2332c1945850:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n kyc -v 1.0 -p /opt/gopath/src/github.com/chaincode/ -l node
2019-04-23 19:42:50.134 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-04-23 19:42:50.134 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-04-23 19:42:50.784 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
root@2332c1945850:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.kyc-example.com:7050 -C mychannel -n kyc -v 1.0 -c '{"Args":["init"]}' -P "OR ('BanksMSP.peer','Customer-portalMSP.peer')"
2019-04-23 19:43:11.083 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-04-23 19:43:11.083 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg timeout expired while starting chaincode kyc:1.0 for transaction
``````````````
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a7eca3bf67c5 dev-peer0.banks.kyc-example.com-kyc-1.0-85cfdbbf05d137aa76cf24ca528689e8342322e809595bfd41c384bd90f135f5 "/bin/sh -c 'cd /usr…" 6 seconds ago Exited (1) 3 seconds ago
Here's the log of this short lived chaincode container:
$ docker logs a7eca3bf67c5
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-23T19_43_13_385Z-debug.log
````````````
Here's my package.json:
{
"name": "kyc",
"version": "1.0.0",
"description": "kyc chaincode in node",
"main": "kyc.js",
"dependencies": {
"fabric-shim": "~1.4.0"
},
"devDependencies": {},
"scripts": {
"start": "node kyc.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
``````````````
I expect it to not give this error as start script has been provided in package.json