Search code examples
hyperledger-fabricblockchainhyperledger

Cannot run peer because cannot init crypto: error while using peer command


I am working on Hyperledger fabric 2.3 and I got this error whenever I try to use peer command. and followed the steps are as follows: https://hyperledger-fabric.readthedocs.io/en/release-2.2/deploy_chaincode.html#package-the-smart-contract So that I can use peer command outside the CLI.

Error: ERRO 001 Cannot run peer because cannot init crypto, specified path "/home/ubuntu/fabric-samples/config/msp" does not exist or cannot be accessed: stat /home/ubuntu/fabric-samples/config/msp: no such file or directory

bash# export PATH=${PWD}/../bin:$PATH

bash# peer version

peer:

Version: 2.3.1

Commit SHA: 2f69b4222

Go version: go1.14.12

OS/Arch: linux/amd64

Chaincode:

Base Docker Label: org.hyperledger.fabric

Docker Namespace: hyperledger

bash# peer channel list

2021-03-16 08:12:25.954 UTC [main] InitCmd -> ERRO 001 Cannot run peer because cannot init crypto, specified path "/home/ubuntu/fabric-samples/config/msp" does not exist or cannot be accessed: stat /home/ubuntu/fabric-samples/config/msp: no such file or directory

enter image description here

Please do tell me what is the meaning of this error and how to resolve it.


Solution

  • You can try setting the CORE_PEER_MSCONFIGPATH variable:

    echo $CORE_PEER_MSPCONFIGPATH
    

    If you have set this environment variable, you can get output at this path:

    /home/www/byfn-on-k8s/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp
    

    which is the path of your msp.

    then you can check msp dir in this path is correct or not.

    Terminal Text

    If there is no output, you may not have set the CORE_PEER_MSPCONFIGPATH environment variable.