【问题标题】:Hyperledger Fabric chaincode installation on peer0.org1 has failedpeer0.org1 上的 Hyperledger Fabric 链码安装失败
【发布时间】:2021-01-26 15:23:15
【问题描述】:

我正在尝试按照教程 Using the Fabric test network 获取最新版本 (v2.2.1) 并且一切正常,直到我尝试使用 ./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
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

如果我尝试建议的go mod vendor,我会得到go: no dependencies to vendor 作为答案。


附加信息:

虚拟机:Oracle VM VirtualBox

主持人:Windows 10

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

Go 版本: go version go1.13.8 linux/amd64

【问题讨论】:

    标签: hyperledger-fabric vendor chaincode


    【解决方案1】:

    试试

    go mod tidy
    go mod vendor
    

    看看是否有帮助。看起来 mod 可能会将文件放在一个目录中并在其他地方查找它们。默认情况下,Go 现在在 $Home/go 目录中查找 Go 项目。可能 Go 正在 $home/go/pkg 或其他地方出售项目,而这可能不在您的路径中?

    也可以看看https://golang.org/doc/gopath_code.html#GOPATH

    【讨论】:

      【解决方案2】:

      请检查并更改以下文件中的 go 版本:

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

      更改设置 go 版本的行

      go 1.14
      

      go 1.13
      

      这解决了我的问题。

      【讨论】:

        【解决方案3】:

        尝试在您的对等配置中添加 GODEBUG: "netdns=go"

        【讨论】:

        • 您的意思是在 core.yaml 文件中吗?或者别的地方?谢谢
        • 如果您使用 docker-compose 作为对等方,则添加为环境变量的一部分。如果您在 kubernetes 中将 peer 作为 pod 运行,则将其添加到 configmap
        猜你喜欢
        • 1970-01-01
        • 2020-10-12
        • 2021-04-11
        • 2019-04-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多