ubuntu

时间:2018-01-08 16:58:17

标签: ubuntu hyperledger-fabric hyperledger

Greetings hyperledger devs,

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

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

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

我是否需要在go root文件夹中移动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 个答案:

答案 0 :(得分:2)

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

请注意,这是处理事情的更常见方式。

答案 1 :(得分:1)

要获取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中使用它们。

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

答案 2 :(得分:0)

它奏效了。不得不放在

[ melds_by(.[]; {street, housenumber})
  | .[1] + .[0]
  | with_entries(.key |= if . == "member" then "members" else . end) ]

要遵循的步骤。

  

在/ usr / local / go / src

中创建了新文件夹      

mkdir github.com

     

mkdir hyperledger

     

cd hyperledger /

     

git clone -b master https://github.com/hyperledger/fabric-samples.git

     

从网站卷曲特定于平台的二进制文件。

     

export PATH = / usr / local / go / src / hyperledger / bin:$ PATH

     

cd fabric-samples / first-network

     

./ byfn.sh -m generate

我可以用漂亮的控制台输出。 :)