Sanket Shevkar
Sanket Shevkar

Reputation: 145

Chain Code not deploying on Test Network after executing the deployment script in Hyperledger Fabric 2.0 documentation

I ran the script ./network.sh deployCC, then its not able to deploy it on the network(Fabric 2.0), this is the error:

deploying chaincode on channel 'mychannel'

Vendoring Go dependencies ...
~/Desktop/Fabric/fabric-samples/chaincode/fabcar/go 
~/Desktop/Fabric/fabric-samples/test-network
go: unknown subcommand "mod"
Run 'go help' for usage.
~/Desktop/Fabric/fabric-samples/test-network
Finished vendoring Go dependencies
Using organization 1
++ peer lifecycle chaincode package fabcar.tar.gz --path 
../chaincode/fabcar/go/ --lang golang --label fabcar_1
++ res=1
++ set +x
Error: error getting chaincode bytes: listing deps for pacakge 
../chaincode/fabcar/go/ failed: exit status 2
!!!!!!!!!!!!!!! Chaincode packaging on peer0.org1 has failed 
!!!!!!!!!!!!!!!!

ERROR !!! Deploying chaincode failed

Upvotes: 5

Views: 2743

Answers (3)

akash
akash

Reputation: 829

As previous answer suggest: previous go lang version causes this issue

so first remove previous go : (suggested answers doesn't remove go so i added it here)

  1. sudo apt-get remove golang-go
  2. sudo apt-get remove --auto-remove golang-go
  3. sudo apt-get purge golang-go

download latest go and add go/bin path to environment variable

Upvotes: 1

Rob Murgai
Rob Murgai

Reputation: 279

I agree, this looks like a Go version issue. Fabric 2.0 has a prerequisite of Go version 1.13

Before 1.11 Go did not have the mod command(I think). So if you did install Go version 1.13, maybe you didn't remove the older version and its still pointing to the older version of Go.

Do a

peer version

in the same terminal where you ran the ./network.sh deployCC command and check the version of Golang that was being used. If you do see 1.10 being used then, you need to upgrade Golang.

Take a look at the install instructions at https://golang.org/doc/install and follow the uninstall steps for the old version and the install steps for the new version and also ensure you have the Path Variables set for Fabric

Upvotes: 0

Shubham Jaiswal
Shubham Jaiswal

Reputation: 610

The issue is with the Go package you installed.Which version you have installed? The ideal way to install the latest Go is from here.Go

And if your using ubuntu don't go with the apt installation.

First remove apt installed go

  • $ sudo apt-get remove go
  • Download the tar file for linux from the site https://golang.org/dl/ 450

  • Execute the command $ sudo tar -C /usr/local -xzf

Upvotes: 1

Related Questions