Blockchain Hyperledger Fabric — 问题和解决方案

外网看到了一个关于fabric网络搭建遇到问题的好文,搬运过来
Blockchain Hyperledger Fabric — Errors & Solutions
Hello, In this article I wanted to share some of the errors you might face & the possible solutions.
please note that, I have faced “n” number of errors while I was working in Blockchain project, I have spent countless hours reading out articles, reaching out experts to fix the same. This article is to just help the people who are beginners & struggling to solve the errors that are quite often pop up during your development stage. If you have any errors that are not listed here, please feel free to comments, will get it added .
Error No 1:
Error: Error trying to ping. Error: 2 UNKNOWN: make sure the chaincode test-registry has been successfully instantiated and try again: could not find chaincode with name ‘test-registry’
Solutions: Make sure that you have installed the network before you start. Use below commands to start the network

  • composer network install — card PeerAdmin@hlfv1 — archiveFile [email protected]
  • composer network start — networkName networkname — networkVersion 0.0.1 — networkAdmin admin — networkAdminEnrollSecret adminpw — card PeerAdmin@hlfv1 — file networkadmin.card
    Error No 2:
    Error:
    docker: Error response from daemon: Conflict. The container name “/composer-playground” is already in use by container “9f224b04663a4fa65f50843e5f7e28f7e7df662507a9b42ae5dfc72fd3433405”. You have to remove (or rename) that container to be able to reuse that name.
    See ‘docker run — help’.
    Solutions: Kill the dockers by running following command & re-execute the composer-playground command (“docker run — name composer-playground — publish 8080:8080 hyperledger/composer-playground”)
    docker rm -f $(docker ps -a -q)
    docker kill $(docker ps -q)
    docker rm $(docker ps -aq)
    docker rmi $(docker images dq-* -q)
    Error No 3:
    Error: Chaincode already exists error
    Solutions: Kill docker images, stop fabric & start fabric again. Once it runs fine, then start deploying the business network card again.
    ./stopFabric.sh
    ./startFabric.sh
    Error No 4:
    Error: NG Serve Error
    Solutions: Use npm instead of ng serve.
    npm start
    Error No 5:
    Error: Authorisation error REST-API
    Solutions: Setup COMPOSER_PROVIDERS in environment variable, and restart the composer-rest-server
    Follow this link https://github.com/hyperledger/composer/blob/master/packages/composer-website/jekylldocs/integrating/enabling-rest-authentication.md
    Error No 6:
    Discovering types from business network definition …
    Connection fails: Error: Error trying to ping. Error: 2 UNKNOWN: make sure the chaincode ‘network-name’ has been successfully instantiated and try again: could not find chaincode with name ‘network-name’
    Solutions: Make sure to install & start the business network before you run composer-rest-server command.
    1)composer network install — card PeerAdmin@hlfv1 — archiveFile [email protected]
    2)composer network start — networkName ‘network-name’ — networkVersion 0.0.1 — networkAdmin admin — networkAdminEnrollSecret adminpw — card PeerAdmin@hlfv1 — file networkadmin.card
    ERROR No 7:
    ERROR: for couchdb Cannot create container for service couchdb: Conflict. The container name “/couchdb” is already in use by container “de8ceaf8f21b53bb4c9883eb618448f6f07c7690bea8ab122ef3b689e846eab4”. You have to remove (or rename) that Creating orderer.example.com … error
    Solutions: Kill the dockers by running following command
    docker rm -f $(docker ps -aq)
    Error No : 8
    Error: Cannot find module ‘fabric-client’
    Solution: Perform npm update, this will install necessary plug-in’s & modules.
    npm update
    Error No : 9
    Error: npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?
    Solution: perform npm install, this will install necessary node_modules.
    npm install
    Error No: 10
    Error: Angular2 app generated by “yo fabric-composer” does not have UI for Transactions
    Solutions: We have issue open in Github — please follow the issue for more updates
    Solution Update :
    Go to .component.html file in src/app/ folder and check for line

user = await client.setUserContext({username:username, password:secret});
logger.debug(‘Successfully enrolled username %s and setUserContext on the client object’, username);

}
if(user && user.isEnrolled) {
if (isJson && isJson === true) {
var response = {
success: true,
secret: user._enrollmentSecret,
message: username + ‘ enrolled Successfully’,
};
return response;
}
} else {
throw new Error(‘User was not enrolled ‘);
}
} catch(error) {
let message = ‘Failed to register the username ‘ + username + ‘ for organization ‘ + userOrg + ‘ with error: ‘ + error.toString();
logger.error(message);
var response = {
success: false,
message: message,
};
return response;
}
};
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
Note: Like this article?, give Logeswaran a thumbs-up(Claps) & follow him on Linkedin / Twitter
Do you have an error which is not listed here? pls go ahead and add that in the comment section below.

你可能感兴趣的:(技术)