我在全球安装composer-cli composer -v
后运行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)
我执行了以下命令npm ls -g --depth=0
并找到了
/usr/local/lib
├── composer-cli@0.19.0
我下载了Hyperledger Fabric,我试图在本地运行它的一个实例,FABRIC_VERSION设置为hlfv11。当我执行/createPeerAdminCard.sh
时,这会让我失误: -
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
如您所见,我已经安装了composer-cli@0.19.0.Fabric无法检测到其安装。任何人都可以帮我解决这个问题。
答案 0 :(得分:1)
我遇到了同样的问题,我将节点更新到v9.11.1并且工作正常。
答案 1 :(得分:0)
不确定get(cardName)
但对于compose-cli,它主要与您安装nvm和node及其版本有关。只需卸载并再次按照教程进行安装即可。
这里大致是我终端的输入来解决这个问题。
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
答案 2 :(得分:0)
首先卸载已安装的composer-cli,然后使用root执行所有操作 然后以下命令将解决您的问题。
npm install --unsafe-perm -g composer-cli
我已经尝试过了,现在一切都很好