倪钦崟 2020-09-01 16:44 采纳率: 0%
浏览 592
已采纳

安装链码时为什么报了can not find package 的错

我的GOPATH没问题,在正确的路径下有shim和peer的包,直接go build 链码也能成功,但是安装链码时会报错如下:

安装链码失败: installing chaincode failed: Multiple errors occurred: - Transaction processing for endorser [localhost:7051]: Chaincode status Code: (500) UNKNOWN. Description: could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "/chaincode/input/src/github.com/kongyixueyuan.com/kongyixueyuan/chaincode/main.go:6:2: cannot find package "github.com/hyperledger/fabric-chaincode-go/shim" in any of:
    /usr/local/go/src/github.com/hyperledger/fabric-chaincode-go/shim (from $GOROOT)
    /chaincode/input/src/github.com/hyperledger/fabric-chaincode-go/shim (from $GOPATH)
    /go/src/github.com/hyperledger/fabric-chaincode-go/shim
/chaincode/input/src/github.com/kongyixueyuan.com/kongyixueyuan/chaincode/main.go:7:2: cannot find package "github.com/hyperledger/fabric-protos-go/peer" in any of:
    /usr/local/go/src/github.com/hyperledger/fabric-protos-go/peer (from $GOROOT)
    /chaincode/input/src/github.com/hyperledger/fabric-protos-go/peer (from $GOPATH)
    /go/src/github.com/hyperledger/fabric-protos-go/peer
" - Transaction processing for endorser [localhost:7151]: Chaincode status Code: (500) UNKNOWN. Description: could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "/chaincode/input/src/github.com/kongyixueyuan.com/kongyixueyuan/chaincode/main.go:6:2: cannot find package "github.com/hyperledger/fabric-chaincode-go/shim" in any of:
    /usr/local/go/src/github.com/hyperledger/fabric-chaincode-go/shim (from $GOROOT)
    /chaincode/input/src/github.com/hyperledger/fabric-chaincode-go/shim (from $GOPATH)
    /go/src/github.com/hyperledger/fabric-chaincode-go/shim
/chaincode/input/src/github.com/kongyixueyuan.com/kongyixueyuan/chaincode/main.go:7:2: cannot find package "github.com/hyperledger/fabric-protos-go/peer" in any of:
    /usr/local/go/src/github.com/hyperledger/fabric-protos-go/peer (from $GOROOT)
    /chaincode/input/src/github.com/hyperledger/fabric-protos-go/peer (from $GOPATH)
    /go/src/github.com/hyperledger/fabric-protos-go/peer

其中说的$GOPATH和我设置的也不一样,我的GOPATH是/home/niqinyin/go

  • 写回答

3条回答 默认 最新

  • helloksyou 2020-12-18 16:03
    关注

    链码必须放在$GOPATH/src/下面,安装时不要全路径,把路径去掉“$GOPATH/src/”后剩下的就行

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
  • ¥15 远程安装一下vasp
  • ¥15 自己做的代码上传图片时,报错
  • ¥15 Lingo线性规划模型怎么搭建
  • ¥15 关于#python#的问题,请各位专家解答!区间型正向化
  • ¥15 unity从3D升级到urp管线,打包ab包后,材质全部变紫色
  • ¥50 comsol温度场仿真无法模拟微米级激光光斑
  • ¥15 上传图片时提交的存储类型
  • ¥15 VB.NET如何绘制倾斜的椭圆
  • ¥15 arbotix没有/cmd_vel话题