部署Hyperledger Fabric报错Error: error getting chaincode bytes: failed to calculate dependencies: incomplete package: github.com/hyperledger/fabric-chaincode-go/shim

报错1

Error: error getting chaincode bytes: failed to calculate dependencies: incomplete package: github.com/hyperledger/fabric-chaincode-go/shim
!!!!!!!!!!!!!!! Chaincode packaging on peer0.org1 has failed !!!!!!!!!!!!!!!!

apt-get install go 的版本比较低。卸载了先。然后下载go1.13.5.linux-amd64.tar.gz进行安装。

# tar zxvf go1.13.5.linux-amd64.tar.gz
# mv go /usr/local/

# vim /etc/profile
#set golang env
export GOROOT=/usr/local/go
export GOPATH=/opt/goworkspace
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/go/bin
# source /etc/profile
# go version
go version go1.13.5 linux/amd64

环境变量:

# go env


换成国内代理:

# go env -w GOPROXY=https://goproxy.cn
# export GOPROXY=https://goproxy.cn


运行测试网络

#cd /opt/fabric/fabric-samples/first-network
# ./byfn.sh down
#./byfn.sh up -c mychannel -s couchdb -a

报错2

Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
2020-03-31 09:44:51.055 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'mychannel': error authorizing update: error validating ReadSet: proposed update requires that key [Group]  /Channel/Application be at version 0, but it is currently at version 1
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

ERROR !!!! Test failed
root@ubuntu:/opt/fabric/fabric-samples/first-network# 

已经存在mychannel,之前启动的fabric network没有正常停止,如果之前执行./byfn.sh up,那么相应的执行./byfn.sh down来停止fabric network。不要直接使用docker stop 或者 docker rm 停止删除容器。
注意,环境变量的配置添加到/etc/bash.bashrc,使不论什么用户登录都生效。

原文地址:https://www.cnblogs.com/zoujiaojiao/p/12606909.html