composer -v 在全局安装 composer-cli 后抛出错误
composer -v throws error after global installation of composer-cli
在全局安装 composer-cli npm i -g composer-cli
后 运行 composer -v
时出现以下错误:-
/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 无法检测到它的安装。谁能帮我解决这个问题。
我遇到了同样的问题,我将节点更新到 v9.11.1,它工作正常。
不确定 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
首先卸载安装的composer-cli,然后使用root执行所有操作
并且以下命令将解决您的问题。
npm install --unsafe-perm -g composer-cli
我试过了,现在一切正常
在全局安装 composer-cli npm i -g composer-cli
后 运行 composer -v
时出现以下错误:-
/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 无法检测到它的安装。谁能帮我解决这个问题。
我遇到了同样的问题,我将节点更新到 v9.11.1,它工作正常。
不确定 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
首先卸载安装的composer-cli,然后使用root执行所有操作 并且以下命令将解决您的问题。
npm install --unsafe-perm -g composer-cli
我试过了,现在一切正常