Composer Playground部署.bna文件报错:Chaincode已安装
This error happens because the exact chaincode version (my-business-network@0.0.2-deploy.2) you’re trying to deploy is already installed on your Fabric peer nodes. Composer Playground blocks duplicate installations to prevent conflicts. Here’s how to fix it:
Step 1: Uninstall the Existing Chaincode
You’ve got two straightforward options for this:
Option A: Use the Composer Playground UI
- Head to the Peer Admin section in the left sidebar (look for a peer/node icon or "Admin" labeled menu).
- Find the list of installed chaincodes, locate
my-business-network@0.0.2-deploy.2. - Click the Uninstall or Delete button next to it (the label might be slightly different in v0.19.0, but it’ll be obvious what to select).
Option B: Use the Fabric CLI (if UI doesn’t work)
If the Playground UI doesn’t show an uninstall option, use the command line to clean up:
- Access your Fabric CLI container:
docker exec -it cli bash - Run the chaincode uninstall command (swap out the orderer address if your setup uses a different endpoint):
peer chaincode uninstall -n my-business-network -v 0.0.2-deploy.2 -o orderer.example.com:7050 - Exit the CLI container with
exit.
Step 2: Redeploy Your Business Network
- Go back to Composer Playground, re-upload your
.bnafile, and click Deploy again. This should work now that the duplicate chaincode is removed.
Pro Tip to Avoid This Later
If you’re updating your business network, always increment the version number in your package.json (or business network definition) before repackaging into a .bna file. For example, bump 0.0.2 to 0.0.3—this tells Composer to install a fresh chaincode version instead of trying to reuse the existing one.
内容的提问来源于stack exchange,提问作者PrashantNagawade

