在CentOS 7中部署fabric v2.2.0环境和测试网络时遇到的错误及解决办法


区块链小白,哦不大白,啥都不懂,踩坑踩的太多了
部署了两个月有点头目了,记录一下,好记性不如烂笔头嘛

一、运行 ./network.sh deployCC 命令时出现以下错误

Error: failed to normalize chaincode path: ‘go list’ failed with: go: github.com/golang/[email protected]: Get “https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.2.mod”: dial tcp 34.64.4.113:443: connect: connection refused: exit status 1
Chaincode packaging on peer0.org1 has failed
Deploying chaincode failed

在这里插入图片描述
解决办法

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

再次运行 ./network.sh deployCC 就没error了
在这里插入图片描述

二、运行yum update时出现以下错误

已加载插件: fastestmirror,security
/var/run/yum.pid已被锁定,PID为1610的另一个程序正在运行。

解决办法
删除文件后再次运行yum即可。

rm -f /var/run/yum.pid

三、此步设置环境变量后执行命令出现错误

在这里插入图片描述
命令:

peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${
    
    PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${
    
    PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${
    
    PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}'

Error: error getting client certificate: failed to load config for PeerClient: unable to load peer.tls.rootcert.file: open /root/go/src/github.com/hyperledger/fabric/fabric-samples/config/tls/ca.crt: no such file or directory

在这里插入图片描述

原因:前边设置环境变量的五条命令我是一起复制粘贴上去运行的

解决办法

每条命令分别运行
在这里插入图片描述
第一条命令export CORE_PEER_TLS_ENABLED=true我前边执行过一次,这里不再执行。
运行出这个结果即成功了
INFO 001 Chaincode invoke successful. result: status:200

第一次接触centos 7,hyperledger fabric,如有错误还请指教,互相学习,学习愉快!!

猜你喜欢

转载自blog.csdn.net/wytljs/article/details/109411972