Nodejs cannot access Hyperledger composer shows error

0 votes

I am trying to build an example application using nodejs and Hyperledger-composer.

My system is Ubuntu 16.04. and I installed nodejs v8.10 using NVM. 

The problem I am having is on the connect() function to my "admin@borrow-network" business network:

this.businessNetworkDefinition = this.bizNetworkConnection.connect('admin@borrow-network');

The error that I am getting is the following:

Error: Failed to load connector module "composer-connector-hlfv1" for connection type "hlfv1". Must create ConnectionManager with a ConnectionProfileManager implementation.

I tried to include additional parameters inside the connect() function:

.connect('PeerAdmin@hlfv1', 'admin@borrow-network','admin','adminpw');

Then it showed a different error

UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'cardName' on string 'admin@borrow-network' at cardStore.get.then(...././lib/businessnetworkconnection.js)

Am I doing something wrong? Please, any help is much appreciated.

Oct 23, 2018 in Blockchain by sabby
• 4,350 points
128 views

1 answer to this question.

0 votes

1) you need Node 8.9.x or higher (eg, 8.11 etc - not node 9)  https://hyperledger.github.io/composer/installing/installing-prereqs.htmlsuggest to uninstall old composer modules, get your node version up to speed using nvm then switch to that node version (8.9.x) and install composer modules (then the 'gyp' pre-compile issue gets resolved) etc as per https://hyperledger.github.io/composer/installing/development-tools

2) Don't use sudo or root privileges to install Composer (npm) modules - (you know that, just saying) - for npm errors / permission denied if you have such issues - suggest to follow the best practices here https://docs.npmjs.com/getting-started/fixing-npm-permissions including recommendation to install a Node Version Manager (install NVM then use that to manage Node installs) - more info here -> https://github.com/hyperledger/composer-knowledge-wiki/blob/latest/knowledge.md#information_source--composer-installation-issues (items 1, 2)

answered Oct 23, 2018 by Perry
• 17,020 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,630 points
358 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,050 points
79 views
0 votes
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 27,630 points
67 views
+1 vote
1 answer
+1 vote
7 answers
+1 vote
1 answer