美文网首页
fabric部署链码报错找不到包cid: cannot find

fabric部署链码报错找不到包cid: cannot find

作者: Dakini_Wind | 来源:发表于2020-04-06 18:41 被阅读0次

    今天在fabric链码中加入了cid包,结果实例化出现了问题,搜索了网上N条解决方案无果,后在开源社区群中经大佬指点,使用govendor解决~
    毕竟网上直接给出解决方案的文章太稀少,在此分享一下,希望能帮到大家。


    报错如下:

    实例化链码失败: sending deploy transaction proposal failed: Multiple errors occurred: - Transaction processing for endorser [st:7151]: Chaincode status Code: (500) UNKNOWN. Description: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/questionbank-api/chaincode/utils.go:6:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/lib/cid" in any of:
            /opt/go/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOROOT)
            /chaincode/input/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOPATH)
            /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/lib/cid
    " - Transaction processing for endorser [localhost:7051]: Chaincode status Code: (500) UNKNOWN. Description: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "chaincode/input/src/questionbank-api/chaincode/utils.go:6:2: cannot find package "github.com/hyperledger/fabric/core/chaincode/lib/cid" in any of:
            /opt/go/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOROOT)
            /chaincode/input/src/github.com/hyperledger/fabric/core/chaincode/lib/cid (from $GOPATH)
            /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/lib/cid
    "
    

    解决方案:
    安装govendor:

    #可能需要管理员权限进行安装
    go get github.com/kardianos/govendor
    

    进入链码文件夹中:

    govendor init
    govendor add +external
    

    相关文章

      网友评论

          本文标题:fabric部署链码报错找不到包cid: cannot find

          本文链接:https://www.haomeiwen.com/subject/cnabphtx.html