windows 10 Error: chaincode install failed with status: 500

Solution for windows 10 Error: chaincode install failed with status: 500
is Given Below:

I am getting this error on windows 10 and the command I am using is
“./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript”
and the error I am getting is :

Error: chaincode install failed with status: 500 – failed to invoke backing implementation of ‘InstallChaincode’: could not build chaincode: docker build failed: docker image inspection failed: cannot connect to Docker endpoint
Chaincode installation on peer0.org1 has failed
Deploying chaincode failed

Docker version 20.10.7, build f0df350
docker-compose version 1.29.2, build 5becea4c

The command and the response of above :

/c/fabric-samples/test-network (main)
$ ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript
deploying chaincode on channel ‘mychannel’
executing with the following

  • CHANNEL_NAME: mychannel
  • CC_NAME: basic
  • CC_SRC_PATH: ../asset-transfer-basic/chaincode-javascript/
  • CC_SRC_LANGUAGE: javascript
  • CC_VERSION: 1.0
  • CC_SEQUENCE: 1
  • CC_END_POLICY: NA
  • CC_COLL_CONFIG: NA
  • CC_INIT_FCN: NA
  • DELAY: 3
  • MAX_RETRY: 5
  • VERBOSE: false
  • peer lifecycle chaincode package basic.tar.gz –path ../asset-transfer-basic/chaincode-javascript/ –lang node –label basic_1.0
  • res=0
    Chaincode is packaged
    Installing chaincode on peer0.org1…
    Using organization 1
  • peer lifecycle chaincode install basic.tar.gz
  • res=1
    Error: chaincode install failed with status: 500 – failed to invoke backing implementation of ‘InstallChaincode’: could not build chaincode: docker build failed: docker image inspection failed: cannot connect to Docker endpoint
    Chaincode installation on peer0.org1 has failed
    Deploying chaincode failed

Ok, I am not 100% sure but to package nodejs chaincode on windows you need some necessary Visual Studio C++ Build Tools which seems to be missing /cause of error.

npm install --global windows-build-tools

Checkout Windows extra under – Prerequisites Hyperledger-fabric docs