Fabric first-sample常見錯誤

2020-10-18 13:00:21

1、ERRO 001 Cannot run peer because cannot init crypto, folder "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" does not exist

解決方案:清空容器

docker stop $(docker ps -q) & docker rm $(docker ps -aq)

然後就變成新的問題2了

2、Error: got unexpected status: FORBIDDEN -- Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!

解決方案:這個問題產生的原因是之前產生的證書在docker裡面,沒有清乾淨

docker-compose -f docker-compose-cli.yaml down --volumes --remove-orphans
docker volume prune

然後就可以了,然後使用generate、up初始化和啟動網路就可以了