首先放一下成功实现第一个区块链网络截图
所看教程链接:
https://blog.csdn.net/Phather/article/details/106209475
同门也是根据这个链接搭建的,过程很顺利,但是我却报错,错误反复报出,在网上查找之后终于解决。我安装的是1.4.4版本。
1----第一个错误:
错误代码:
Failed to pull hyperledger/fabric-ccenv:latest: API error (404): manifest for hyperledger/fabric-cc
解决方法:
需要拉取pull hyperledger/fabric-ccenv:latest这个镜像,进入
https://hub.docker.com/r/hyperledger/fabric-ccenv链接,界面如下,查找和自己hyperledger/fabric-orderer版本一样的镜像,我的是1.4.4所以搜索1…4.4,可以直接点击右边的复制到终端。
命令行输入两条语句:
docker pull hyperledger/fabric-ccenv:1.4.4
docker tag hyperledger/fabric-ccenv:1.4.4 hyperledger/fabric-ccenv:latest
之后在命令行输入:
docker images
查看是否拉取成功。结果如下:
2—第二个错误
是反复出现很多次的一个错误,
/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/
/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
类似这样开头意GOPATH的错误是go环境变量配置有问题!!!
上面开头我看的教程里:
如果出现gopath的错误还需要在最后加入以下语句:
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
CORE_PEER_LOCALMSPID="Org1MSP"
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
里面最下面的语句是这样的:
esc退出 输入:wq保存并退出。
最后记得输入
source /etc/profile
让编辑生效。
以上操作做完解决问题。
3—第三个问题
implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the ‘Writers’ sub-policies to be satisfied: permission denied
这个问题我是看了https://blog.csdn.net/bean_business/article/details/112335991这个博主的文章,我个人理解原因是通道重复创建重名的问题,我就重新新建了一个通道,换了一个名字,比如onechannel,之后就没有报这个错了,不知道是否是正确的解决方法,如果大家有什么好的办法欢迎留言提出。
./byfn.sh generate
这个命令默认创建一个名为mychannel的通道,重新创建新的通道名需要输入:
./byfn.sh generate -c [通道名]
./byfn.sh generate -c onechannel
4—如果上述修改过后,仍然报错可以尝试如下步骤:
把教程里的clone中的https://github.com 换成https://github.com.cnpmjs.org。
[root@localhost hyperledger]# git clone -b v1.4.4 https://github.com.cnpmjs.org/hyperledger/fabric
[root@localhost hyperledger]# git clone -b v1.4.4 https://github.com.cnpmjs.org/hyperledger/fabric-samples
————————————————
上述所写是个人在环境搭建出现的错误及解决方法,大家有什么问题可以在评论区留言,一起交流。如果报错,建议把错误代码的主要部分复制到浏览器,查询得到的结果匹配会更好一些。你遇到的错误可能之前的人也会遇到,没关系,大家加油,我继续秃头去了。