環境:fabric v2.2.0
javascript
執行fabric-sampke/test-network
中帳本交互指令的時報錯java
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","asset6"]}'
報錯以下:git
Cannot run peer because cannot init crypto, specified path "/home/yujialing/go/src/github.com/hyperledger/fabric-samples/config/msp" does not exist or cannot be accessed: stat /home/yujialing/go/src/github.com/hyperledger/fabric-samples/config/msp: no such file or directory
github
緣由是沒有配置環境變量,以網絡中的某個組織的某個節點進行交互網絡
好比配置環境變量成爲Org1
Peer0
的角色spa
export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=${ PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=${ PWD}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp export CORE_PEER_ADDRESS=localhost:7051
再次執行帳本交互指令code
peer chaincode query -C mychannel -n basic -c '{"Args":["ReadAsset","asset6"]}'
成功解決Cannot run peer because cannot init crypto, specified path "/home/yujialing/go/src/github.com/hyperledger/fabric-samples/config/msp" does not exist or cannot be accessed: stat /home/yujialing/go/src/github.com/hyperledger/fabric-samples/config/msp: no such file or directory
的問題
blog
歡迎小夥伴的討論,如有問題請在評論區評論或私信,謝謝你。圖片