Reputation: 47
I have started a fabric network with three orgs one pear for each org and one orderer. Created one channel and added the peers to the channel.But when i try to install the chaincode it says directory not found. I also mounted the volume inside my cli config. i am entering cli bash before entering the command also checked using peer channel list command to see if my peer is joined in a channel.
my cli config
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/fabric-samples/food-network/chaincode
- ./crypto-config:/opt/gopath/fabric-samples/food-network/crypto-config/
my peer command
peer chaincode install -n chain chain -v 1.0
error
Error: open /opt/gopath/fabric-samples/food-network/chaincode/chain: no such file or directory
my chain code is named chain.go. Its a go file and it has been built.
also when i try this command:
peer chaincode install -n chain -p chain -v 1.0
it gives this error:
error getting chaincode code chain: path to chaincode does not exist: /opt/gopath/src/chain
Upvotes: 0
Views: 555
Reputation: 12013
In order to install chaincode, you need to build a chaincode package. You can either run
peer chaincode package ...
followed by
peer chaincode install ...
or you can use the -p
option with peer chaincode install
to package and install together.
When using the peer cli to package chaincode, it will look for your Go chaincode under $GOPATH/src
. The cli container has its GOPATH
set to /opt/gopath
.
I'm not sure where your actual chaincode is located, but assuming your your Go code is located in ./../chaincode
on your host, you would need to change your volume mount to
- ./../chaincode/:/opt/gopath/src/chaincode
and then you can run
peer chaincode install -n chain -p chaincode -v 1.0
Upvotes: 1