首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Hyperledger Fabric 2中部署链码时出错

在Hyperledger Fabric 2中部署链码时出错
EN

Stack Overflow用户
提问于 2020-12-09 20:42:11
回答 4查看 4.3K关注 0票数 0

我正在尝试部署链码:

  • 超分类器织物2

  • Ubuntu 20.04

go版本go1.13.8 linux/amd64 64

我总是犯这样的错误:

代码语言:javascript
复制
alex@alex:~/fabric-samples/test-network$ ./network.sh deployCC
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
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go/ --lang golang --label basic_1.0
+ res=0
Chaincode is packaged
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

我不知道为什么会发生这个问题。我在网上读过书,没有明确的解决办法.

有什么想法吗?

谢谢

EN

回答 4

Stack Overflow用户

发布于 2020-12-11 01:57:35

我留下它作为一个评论,但版本是问题。

In particular, unlike 1.13, the vendering behavior is different from version 1.14 (>higher), and this seems to be a problem due to this process. – myeongkil kim

安装方法有问题是没有道理的。您在问题中说,已经安装了go版本go1.13.8 linux/amd64 64。如果环境变量设置良好,并且官方go正常工作,那么根据安装方法的不同执行就没有意义了。

添加,I don't think the problem was Go version, but the way of installing Go (at least in Ubuntu). – AlexAcc,如果您认为版本不是问题,我想知道为什么。

你可以很简单地检查一下。这是一种只在同一环境中更改版本的方法。

因此,我实际运行了它,并且能够确认版本问题是正确的,如下所示:

去1.13.8

代码语言:javascript
复制
# same environment
wget https://golang.org/dl/go1.13.8.linux-amd64.tar.gz
sudo tar -xvf go1.13.8.linux-amd64.tar.gz
sudo mv go /usr/local
go env
代码语言:javascript
复制
cd $GOPATH/src/github.com/hyperledger/fabric-samples/test-network
./network.sh down
./network.sh up
./network.sh deployCC

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

行动1.15.6

代码语言:javascript
复制
# same environment
wget https://golang.org/dl/go1.15.6.linux-amd64.tar.gz
sudo tar -xvf go1.15.6.linux-amd64.tar.gz
sudo mv go /usr/local
go env
代码语言:javascript
复制
cd $GOPATH/src/github.com/hyperledger/fabric-samples/test-network
./network.sh down
./network.sh up
./network.sh deployCC

2020-12-11 10:45:12.229 KST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nJbasic_1.0:4ec191e793b27e953ff2ede5a8bcc63152cecb1e4c3f301a26e22692c61967ad\022\tbasic_1.0" >
2020-12-11 10:45:12.229 KST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: basic_1.0:4ec191e793b27e953ff2ede5a8bcc63152cecb1e4c3f301a26e22692c61967ad
Chaincode is installed on peer0.org1
票数 1
EN

Stack Overflow用户

发布于 2021-08-22 19:17:41

我通过移除容器和体积来解决这个问题:

使用以下命令对容器进行-Stop:docker-compose down

使用以下命令-Delete所有容器:docker rm -f $(docker ps -a -q)

使用以下命令-Delete所有卷:docker volume rm $(docker volume ls -q)

警告:上面的命令将删除所有容器/卷,而不仅仅是由Fabric创建的容器/卷。

票数 1
EN

Stack Overflow用户

发布于 2020-12-09 21:07:27

问题是,我使用的是go,安装时:

代码语言:javascript
复制
apt get 

后来又有:

代码语言:javascript
复制
apt install

但是直到我尝试从官方来源下载go时,它才起作用,我使用wget:

代码语言:javascript
复制
wget https://golang.org/dl/go1.15.6.linux-amd64.tar.gz
sudo tar -xvf go1.15.6.linux-amd64.tar.gz
sudo mv go /usr/local
sudo echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc

这一联系有助于:

https://medium.com/@kaigo/installing-golang-on-ubuntu-20-04-68137ea931

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65224577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档