Hyperledger区块链:运行buildAndDeploy脚本启动业务网络失败
buildAndDeploy脚本启动业务网络失败排查 Hey there, let's dig into this business network startup failure you're hitting with the buildAndDeploy script in Chapter 03 of the ZeroToBlockchain tutorial. Since you've got Docker and Fabric running smoothly and all prior steps completed successfully, let's break down targeted fixes for this specific error on macOS:
Verify Docker container status first
Fire up your terminal and rundocker psto check if all core Fabric containers (likepeer0.org1.example.com,orderer.example.com) are in theUpstate. If any container has exited, rundocker logs <container-name>to pull its crash logs—common culprits here are port conflicts or missing volume permissions.Validate your business network definition
Before running the script, manually validate your network's.bnafile (or Composer project structure) for syntax errors. Use this command:composer network validate -a <your-business-network-file>.bnaThis will flag issues in your model files, access control lists (ACLs), or connection profiles that might be blocking startup.
Clean up stale Fabric environment artifacts
Leftover containers, volumes, or images from previous tests can interfere with new deployments. Run these commands to wipe the slate clean:# Stop and remove all containers docker stop $(docker ps -aq) docker rm $(docker ps -aq) # Remove dev images docker rmi $(docker images dev-* -q) # Prune unused volumes docker volume prune -fRestart your Fabric network afterward, then re-run the
buildAndDeployscript.Fix macOS file system permissions
macOS's strict file permissions can prevent the script from accessing necessary files. Recursively set readable/execute permissions for the Chapter 03 directory:chmod -R 755 MyPath/ZeroToBlockchain/Chapter03This ensures the script can read network definitions and execute sub-commands without hitting permission blocks.
Enable verbose logging in the script
The defaultbuildAndDeployscript might hide detailed error context. Modify thecomposer network startline in the script to add the--verboseflag—this will output granular logs that pinpoint exactly where the startup is failing (e.g., chaincode installation issues, identity authentication errors, or network connectivity problems).Double-check Composer-Fabric version compatibility
Hyperledger Composer and Fabric have strict version matching requirements. Make sure the versions you installed align with what's specified in the tutorial (e.g., Fabric 1.4.x pairs with Composer 0.20.x). Mismatched versions often cause silent startup failures.
Try these steps one by one—most of the time, the verbose logs or container status checks will reveal the root cause quickly. If you get more specific error messages, feel free to share them for deeper troubleshooting!
内容的提问来源于stack exchange,提问作者harry

