can‘t load package: cannot find module providing package github.comhyperledgerfabriccorechaincod

can‘t load package: cannot find module providing package github.comhyperledgerfabriccorechaincod,第1张

 在执行fabric++源码编译时,出现以下问题:

直接make,报错

can't load package: cannot find module providing package github.com/hyperledger/fabric/core/chaincode/shim: working directory is not part of a module
.build/bin/peer
CGO_CFLAGS=" " GOBIN=/root/go/src/github.com/hyperledger/fabric/.build/bin go install -tags "experimental" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.2.0 -X github.com/hyperledger/fabric/common/metadata.CommitSHA=bef689d -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.4.10 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.Experimental=true" github.com/hyperledger/fabric/peer
can't load package: cannot find module providing package github.com/hyperledger/fabric/peer: working directory is not part of a module
make: *** [.build/bin/peer] Error 1

 我又试了一下

go mod init   又出现新的问题

[root@installnode fabric]# git config --global http.proxy
[root@installnode fabric]# git config --global --unset http.proxy
[root@installnode fabric]# go mod init
go: creating new go.mod: module github.com/hyperledger/fabric
go: copying requirements from Gopkg.lock
go: converting Gopkg.lock: stat golang.org/x/sync@1d60e4601c6fd243af51cc01ddf169918a5407ca: unrecognized import path "golang.org/x/sync": https fetch: Get "https://golang.org/x/sync?go-get=1": dial tcp 142.251.42.241:443: i/o timeout
go: converting Gopkg.lock: stat github.com/hashicorp/go-version@4fe82ae3040f80a03d04d2cccb5606a626b8e1ee: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/55a07af7a5aae7cb8a6ac0855c55376f93f703c3f4fca97129b1aa150a83a52e: exit status 128:
	fatal: unable to access 'https://github.com/hashicorp/go-version/': Failed connect to github.com:443; Connection timed out
go: converting Gopkg.lock: stat github.com/spf13/cobra@v0.0.1: unknown revision v0.0.1
go: converting Gopkg.lock: stat google.golang.org/genproto@df60624c1e9b9d2973e889c7a1cff73155da81c4: unrecognized import path "google.golang.org/genproto": https fetch: Get "https://google.golang.org/genproto?go-get=1": dial tcp 172.217.160.113:443: i/o timeout
go: converting Gopkg.lock: stat github.com/miekg/pkcs11@6dbd569b952ec150d1425722dbbe80f2c6193f83: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/cf5d61340771573aed6ee8c4275f2b4f1bb12692808bba89497ec8e4888b8fb3: exit status 128:
	fatal: unable to access 'https://github.com/miekg/pkcs11/': Empty reply from server
go: converting Gopkg.lock: stat github.com/pierrec/lz4@2fcda4cb7018ce05a25959d2fe08c83e3329f169: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/036595127a116abca3f2bfd7bedafedb33d890c2b102d96361815966679432e7: exit status 128:
	fatal: unable to access 'https://github.com/pierrec/lz4/': Empty reply from server
go: converting Gopkg.lock: stat github.com/prometheus/client_golang@v0.8.0: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/6ffa6057942360db9e438bbc1bc03e3efd3ae1d41df4abeb5328ef376a815bfa: exit status 128:
	error: RPC failed; result=7, HTTP code = 0
	fatal: The remote end hung up unexpectedly
go: converting Gopkg.lock: stat github.com/eapache/go-xerial-snappy@bb955e01b9346ac19dc29eb16586c90ded99a98c: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/d6e4eb9c4ce7763510368de51f2ac8ad1f1445d3b0a7997817cc35c74f0f3f7f: exit status 128:
	fatal: unable to access 'https://github.com/eapache/go-xerial-snappy/': Failed connect to github.com:443; Connection timed out
go: converting Gopkg.lock: stat golang.org/x/text@v0.3.0: unrecognized import path "golang.org/x/text": https fetch: Get "https://golang.org/x/text?go-get=1": dial tcp 172.217.160.113:443: i/o timeout
go: converting Gopkg.lock: stat github.com/BurntSushi/toml@v0.3.0: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/ec7059c73d3b4ffc04ddf6278ca6c81ff16e45641dec2d453a2a830539c590c8: exit status 128:
	fatal: unable to access 'https://github.com/BurntSushi/toml/': Encountered end of file
go: converting Gopkg.lock: stat golang.org/x/crypto@21652f85b0fdddb6c2b6b77a5beca5c5a908174a: unrecognized import path "golang.org/x/crypto": https fetch: Get "https://golang.org/x/crypto?go-get=1": dial tcp 172.217.24.17:443: i/o timeout
^C
[root@installnode fabric]# go build --tags nopkcs11
go: cannot find main module, but found Gopkg.lock in /root/go/src/github.com/hyperledger/fabric
	to create a module there, run:
	go mod init
[root@installnode fabric]# go build
go: cannot find main module, but found Gopkg.lock in /root/go/src/github.com/hyperledger/fabric
	to create a module there, run:
	go mod init

原来当目录下没有go.mod的时候,不使用go mod构建 

最终解决办法:禁用go mod,命令如下

 export  GO111MODULE=auto

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/1298493.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存