peer链码安装问题目录未找到
peer chain code install problem directory not found
我已经启动了一个结构网络,其中包含三个组织,每个组织一个梨,一个订购者。当我尝试安装它说找不到目录的链代码时,创建了一个通道并将对等点添加到 channel.But。我还在我的 cli 配置中安装了卷。
我在输入命令之前输入 cli bash 还使用 peer channel list 命令检查我的对等方是否加入了频道。
我的 cli 配置
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/fabric-samples/food-network/chaincode
- ./crypto-config:/opt/gopath/fabric-samples/food-network/crypto-config/
我的对等命令
peer chaincode install -n chain chain -v 1.0
错误
Error: open /opt/gopath/fabric-samples/food-network/chaincode/chain: no such file or directory
我的链码被命名为chain.go。它是一个 go 文件,它已经被构建。
当我尝试这个命令时:
peer chaincode install -n chain -p chain -v 1.0
它给出了这个错误:
error getting chaincode code chain: path to chaincode does not exist: /opt/gopath/src/chain
为了安装链码,您需要构建一个链码包。您可以 运行
peer chaincode package ...
接着是
peer chaincode install ...
或者您可以使用-p
选项和peer chaincode install
一起打包安装。
当使用 peer cli 打包链码时,它会在 $GOPATH/src
下寻找您的 Go 链码。 cli 容器的 GOPATH
设置为 /opt/gopath
。
我不确定您的实际链代码位于何处,但假设您的 Go 代码位于主机上的 ./../chaincode
中,您需要将卷挂载更改为
- ./../chaincode/:/opt/gopath/src/chaincode
然后你可以运行
peer chaincode install -n chain -p chaincode -v 1.0
我已经启动了一个结构网络,其中包含三个组织,每个组织一个梨,一个订购者。当我尝试安装它说找不到目录的链代码时,创建了一个通道并将对等点添加到 channel.But。我还在我的 cli 配置中安装了卷。 我在输入命令之前输入 cli bash 还使用 peer channel list 命令检查我的对等方是否加入了频道。
我的 cli 配置
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/fabric-samples/food-network/chaincode
- ./crypto-config:/opt/gopath/fabric-samples/food-network/crypto-config/
我的对等命令
peer chaincode install -n chain chain -v 1.0
错误
Error: open /opt/gopath/fabric-samples/food-network/chaincode/chain: no such file or directory
我的链码被命名为chain.go。它是一个 go 文件,它已经被构建。
当我尝试这个命令时:
peer chaincode install -n chain -p chain -v 1.0
它给出了这个错误:
error getting chaincode code chain: path to chaincode does not exist: /opt/gopath/src/chain
为了安装链码,您需要构建一个链码包。您可以 运行
peer chaincode package ...
接着是
peer chaincode install ...
或者您可以使用-p
选项和peer chaincode install
一起打包安装。
当使用 peer cli 打包链码时,它会在 $GOPATH/src
下寻找您的 Go 链码。 cli 容器的 GOPATH
设置为 /opt/gopath
。
我不确定您的实际链代码位于何处,但假设您的 Go 代码位于主机上的 ./../chaincode
中,您需要将卷挂载更改为
- ./../chaincode/:/opt/gopath/src/chaincode
然后你可以运行
peer chaincode install -n chain -p chaincode -v 1.0