今天在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
网友评论