4

I'am trying to follow the tutorial Using the Fabric test network for the latest Version (v2.2.1) and everything works fine, up to the point where i try to intsall the chaincode with ./network.sh deployCC.

I get the following output:

deploying chaincode on channel 'mychannel'
executing with the following
- CHANNEL_NAME: mychannel
- CC_NAME: basic
- CC_SRC_PATH: NA
- CC_SRC_LANGUAGE: go
- CC_VERSION: 1.0
- CC_SEQUENCE: 1
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
Determining the path to the chaincode
asset-transfer-basic
Vendoring Go dependencies at ../asset-transfer-basic/chaincode-go/
~/fabric-samples/asset-transfer-basic/chaincode-go ~/fabric-samples/test-network
~/fabric-samples/test-network
Finished vendoring Go dependencies
Using organization 1
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go/ --lang golang --label basic_1.0
+ res=0
Chaincode is packaged on peer0.org1
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode install basic.tar.gz
+ res=1
Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "go: inconsistent vendoring in /chaincode/input/src:
    github.com/golang/protobuf@v1.3.2: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    github.com/hyperledger/fabric-chaincode-go@v0.0.0-20200424173110-d7076418f212: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    github.com/hyperledger/fabric-contract-api-go@v1.1.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    github.com/hyperledger/fabric-protos-go@v0.0.0-20200424173316-dd554ba3746e: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
    github.com/stretchr/testify@v1.5.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

run 'go mod vendor' to sync, or use -mod=mod or -mod=readonly to ignore the vendor directory
"
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed

If I try the suggested go mod vendor I get go: no dependencies to vendor as an answer.


Additional information:

VM: Oracle VM VirtualBox

Host: Windows 10

Linux Version: Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

Go Version: go version go1.13.8 linux/amd64

Volker
  • 40,468
  • 7
  • 81
  • 87
tbh428
  • 65
  • 1
  • 4

3 Answers3

16

Please check and change the go version in the following file:

../fabric-samples/asset-transfer-basic/chaincode-go/go.mod

Change the line setting the go version from

go 1.14

to

go 1.13

This solved the problem in my case.

Marios
  • 176
  • 3
  • I was facing same issue & This solved my error. Was pretty simple. I hope I had knew this earlier would have saved much time. – Deepak Bhavsar Oct 10 '22 at 09:56
0

try to add GODEBUG: "netdns=go" in your peer configuration

GPC
  • 381
  • 2
  • 14
  • Did you mean inside the core.yaml file? Or somewhere else? thx – tbh428 Oct 13 '20 at 13:42
  • if you are using docker-compose for peer then add as part of the environment variable. if you are running peer as a pod in kubernetes then add it to the configmap – GPC Oct 13 '20 at 14:15
0

Try

go mod tidy
go mod vendor

See if that helps. It looks like the mod might be putting files in one directory and looking for them elsewhere. By default Go now looks for Go Projects in $Home/go directory. It might be that Go is vendoring projects in $home/go/pkg or something and that's not in your path, perhaps?

May want to look at https://golang.org/doc/gopath_code.html#GOPATH as well.

Rob Murgai
  • 259
  • 1
  • 6