No version of composer-cli has been detected

2019-03-22 08:31发布

问题:

All,

After following the instructions in this page: Installing the Development Environment to install Hyperledger Composer, I encountered this error every time I use

sudo ./createPeerAdminCard.sh

I am sure that I have installed the correct version of composer-cli by executing these commands:

npm install -g composer-cli@next

or

npm install -g composer-cli@0.19.0

Can someone advice what to do?

回答1:

FYI the correct Install Doc for v0.19.0 of Composer is here

It looks like you are using sudo for some of the commands which may well be causing the problems. You should not need to use root or sudo. There is additional information in the the knowledge wiki about installing.



回答2:

I had the same issues. And I solved it.

  1. Follow the instructions in Installing pre-requisites.

    Very Important the link is below(I am using MacOS) : - https://hyperledger.github.io/composer/latest/installing/installing-prereqs.html

  2. After completing the above step destroy a previous setup

https://hyperledger.github.io/composer/latest/installing/development-tools.html#appendix

or

docker kill $(docker ps -q)
docker rm $(docker ps -aq)
docker rmi $(docker images dev-* -q)

run the above command.

  1. After this:-

Uninstalling the CLI tools ( 4 commands ):

$ npm uninstall composer-cli 
$ npm uninstall composer-rest-server 
$ npm uninstall -g generator-hyperledger-composer
$ npm uninstall -g yo

and installing them again

$ npm install -g composer-cli@0.19.0
$ npm install -g composer-rest-server
$ npm install -g generator-hyperledger-composer
$ npm install -g yo

After that all, check

composer -v.

You will get the required version of a composer. And the continue with the steps mentioned in https://hyperledger.github.io/composer/latest/installing/development-tools.html



回答3:

In my case, I had to set the path variable for npm.

Run the following command:

npm config get prefix

This will give your npm path.

It can give something like: /usr/local/share/npm

Write the following command on your .bashrc or .bash_profile file or simply run the command on your terminal:

export PATH="/usr/local/share/npm/bin:$PATH"

After that:

  • open a new tab or window of the terminal
  • go to your fabric directory where you have the file createPeerAdminCard.sh
  • and run:

./createPeerAdminCard.sh

Now, it should run fine without the 'composer-cli not found' error.



回答4:

For anyone encountering this or related problems, note that the recommended Node version is currently 8.9.x only. See knowledge wiki.

My solution was:

nvm install 8.9.0

nvm use 8.9.0

npm install -g composer-cli