首页 文章

Ubuntu上的Hyperledger fabric src文件夹安装目录

提问于
浏览
2

问候超级开发者,

我正在尝试安装Fabric项目的先决条件 . 大多数工具都在工作,包括curl,docker,docker-compose,npm,go .

我已经在usr / local / go中安装了go并将goroot设置为该文件夹 .

我的Fabric项目位于我的主目录中的单独文件夹中 .

我是否需要在go根文件夹中移动fabric src代码,因为我在运行时遇到以下错误

make cryptogen

无法加载包:github.com/hyperledger/fabric/core/chaincode/shim:在以下任何一个包中找不到包“github.com/hyperledger/fabric/core/chaincode/shim”:/ usr / local / go /src/github.com/hyperledger/fabric/core/chaincode/shim(来自$ GOROOT)/usr/local/go/bin/src/github.com/hyperledger/fabric/core/chaincode/shim(来自$ GOPATH)找到:'/ usr / local / go / bin / src / github / http://www.perperledger / fabric / core / chaincode / shim':没有这样的文件或目录

3 回答

  • 1

    fabric-samples源树可以安装在 $GOROOT 之外 . 为此,您可以使用 $GOPATH 变量指定可以安装各种golang项目的路径 . 例如

    export GOPATH=/home/someacct/go
    mkdir -p $GOPATH/src/github.com/hyperledger
    cd $GOPATH/src/github.com/hyperledger
    git clone -b master https://github.com/hyperledger/fabric-samples.git
    cd fabric-samples
    ...
    

    然后可以从以下位置访问fabric-samples源树:

    $GOPATH/src/github.com/hyperledger/fabric
    

    请注意,这是处理事物的更常见方式 .

  • 2

    要获得Hyperledger Fabric源,您只需运行以下命令,这是正确安装go包的方式:

    go get github.com/hyperledger/fabric
    

    那么你应该能够

    cd $GOPATH/src/github.com/hyperledger/fabric
    

    并执行

    make cryptogen
    

    或使用make文件来构建实验所需的任何内容 . 例如:

    make peer orderer
    

    将分别生成peer和orderer二进制文件 .

    二进制工件将在 $GOPATH/src/github.com/hyperledger/fabric/build/bin 处提供,当然要使用它们,您必须在 $PATH 中使用它们 .

    当然,您可以下载特定于平台的二进制文件,并立即使用它们进行任何本地编译 .

  • 0

    有效 . 不得不放下

    /usr/local/go
    

    要遵循的步骤 .

    在/ usr / local / go / src中创建新文件夹mkdir github.com mkdir hyperledger cd hyperledger / git clone -b master https://github.com/hyperledger/fabric-samples.git curl来自网站的特定于平台的二进制文件 . export PATH = / usr / local / go / src / hyperledger / bin:$ PATH cd fabric-samples / first-network ./byfn.sh -m generate

    我可以把漂亮的控制台输出 . :)

相关问题