gpt4 book ai didi

hyperledger-fabric - 获取链码代码 mycc : path to chaincode does not exist 时出错

转载 作者:行者123 更新时间:2023-12-02 20:06:40 25 4
gpt4 key购买 nike

我正在做这个教程:https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html

现在我在我的 Peer 上,想要安装和实例化 Chaincode。

为此我正在做:

root@23096337731b:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/

但是我得到了这个输出:

2019-01-31 08:01:44.988 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-01-31 08:01:44.988 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: error getting chaincode code mycc: path to chaincode does not exist: /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go

更新:

我认为这是因为我正在这样做:

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/

并且编译器认为github链接是一个本地目录。

最佳答案

关键是你放置链码的地方必须准确挂载。

在教程源码中,当你阅读文件docker-compose-cli.yaml时,你会看到这一行

volumes
- ./../chaincode/:/opt/gopath/src/github.com/chaincode

./../chaincode 是chaincode文件夹的路径

还有一点,如果您选择 golang 作为链码,调用 install chaincode 时的路径会更短(read more):

# this installs the Go chaincode. For go chaincode -p takes the relative path from $GOPATH/src
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/

Node.js 版本:

# this installs the Node.js chaincode
# make note of the -l flag to indicate "node" chaincode
# for node chaincode -p takes the absolute path to the node.js chaincode
peer chaincode install -n mycc -v 1.0 -l node -p /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/

关于hyperledger-fabric - 获取链码代码 mycc : path to chaincode does not exist 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54455891/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com