1

i am getting following error when i run composer -v after installing composer-cli globally npm i -g composer-cli :-

/usr/local/lib/node_modules/composer-cli/node_modules/composer-common/lib/cardstore/businessnetworkcardstore.js:54
async get(cardName) {
      ^^^SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/composer-cli/node_modules/composer-common/index.js:56:43)

I executed following command npm ls -g --depth=0 and found

/usr/local/lib
├── composer-cli@0.19.0

I downloaded Hyperledger Fabric and i am trying to run an instance of it locally, FABRIC_VERSION is set to hlfv11. When i executed /createPeerAdminCard.sh this throws me below error :-

Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is set to 'hlfv11'
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)
No version of composer-cli has been detected, you need to installcomposer-cli at v0.19 or higher

As you see i have already installed composer-cli@0.19.0.Fabric is not able to detect its installation. Can anyone help me in sorting this issue.

Sriram J
  • 174
  • 1
  • 1
  • 9

3 Answers3

1

I was having same issue, I updated node to v9.11.1 and it works fine.

0

Not sure about the get(cardName)

But for the compose-cli, it is mainly has to do with your installation of nvm and node and their versions. Just uninstall and follow the tutorial again to do the installation and it should work.

Here's roughly the input in my terminal to get around this.

  346  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  347  nvm use system
  348  export NVM_DIR="/Users/youssefg/.nvm"
  349  [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  350  nvm use system
  351  nvm uninstall -g a_module
  352  which nvm
  353  nvm --version
  354  touch .bash_profile
  355  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  356  npm uninstall -g a_module
  357  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  358  nvm use system
  359  nvm version
  360  nvm use --lts
  361  nvm install --lts
  362  nvm use --delete-prefix v8.11.1
  363  nvm use --lts
  364  node --version
  365  npm install -g composer-cli
  366  npm install Xcode
  367  npm install -g composer-cli
  368  npm install -g composer-common
  369  npm install -g composer-rest-server
  370  npm install -g generator-hyperledger-composer
  371  npm install composer-common
  372  npm install -g yo
  373  npm install -g composer-playground
  374  composer-common
  375  composer-cli
  376  composer-cli --version
  377  npm install -g composer-cli
  378  npm install -g composer-common
  379  composer-cli --version
  380  composer-common --version
  381  npm install -g composer-cli
  382  composer --version
  383  composer-playground
  384  composer --version
  385  ls
  386  lall
  387  export PATH=~/.nvm/versions/node/v8.10.0/bin/:$PATH
  388  composer --version
0

First of all uninstall the installed composer-cli and then perform all actions using the root and the following command will solve your problem.

npm install --unsafe-perm -g composer-cli

I've tried this and everything is well now

Derrick
  • 3,669
  • 5
  • 35
  • 50