当前目录中找不到composer.json

时间:2017-12-05 08:35:43

标签: json hyperledger-fabric hyperledger hyperledger-composer

大家好,非常抱歉,如果我有一个基本的答案,因为我对此很新。我正在关注YouTube教程Hyperledger Composer开发教程(2/5) - 建模语言(Mac OS X)https://www.youtube.com/watch?v=S2S5cEcmx7Q&t=100s

按照3:22(和教程1/5)的所有步骤,我尝试命令:

composer archive create -a /dist/perishables.bna --sourceType dir --sourceName

结果应该是:

Creating Business Network Archive


Looking for package.json of Business Network Definition
Input directory: /Users/joeheade/composer-sample-networks/packages/perishable-network

Found:
Description: Shipping Perishable Goods Business Network
Name: perishable-network
Identifier: perishable-network@0.1.11

Written Business Network Definition Archive file to 
Output file: ./dist/perishable-network.bna

Command succeeded

当我尝试时,我明白了:

Joe-Heades-MBP:perishable-network joeheade$ composer archive create -a /dist/perishables.bna --sourceType dir --sourceName


  [Symfony\Component\Console\Exception\RuntimeException]  
  The "-a" option does not exist.                         


archive [-f|--format FORMAT] [--dir DIR] [--file FILE] [--ignore-filters] [--] [<package>] [<version>]

如果我检查版本,我会得到这个:

Joe-Heades-MBP:perishable-network joeheade$ composer --version
Composer version 1.5.5 2017-12-01 14:42:57

对于通用命令,我得到了这个:

Joe-Heades-MBP:perishable-network joeheade$ composer archive create
Searching for the specified package.
No composer.json found in the current directory, searching packages from packagist.org
Could not find a package matching create.

请有人帮忙吗?如果我错误地遵循任何Stack Overflow规则,我也很抱歉;这是我的第一篇文章。

提前谢谢!

更新:此外,如果我退后一步,我会得到以下结果:

Joe-Heades-MacBook-Pro:dist joeheade$ compose archive create -a dist/perishables.bna --sourceType dir --sourceName
-bash: compose: command not found

按照https://github.com/composer/composer/issues/6303步骤,我也得到以下回复:

Joe-Heades-MacBook-Pro:perishable-network joeheade$ composer update
Composer could not find a composer.json file in /Users/joeheade/composer-sample-networks/packages/perishable-network
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

2 个答案:

答案 0 :(得分:0)

你在这个命令上错过了一个小点(。) 在执行此命令之前,请确保此目录文件夹中有dist

composer archive create --sourceType dir --sourceName . -a ./dist/perishables.bna 

使用此命令可以创建.bna(商业网络存档)文件。这应该返回预期值。

答案 1 :(得分:0)

您尚未安装Hyperledger Composer。您已经安装了名为composer的其他名称,其命名行名称为composer。 有关Hyperledger Composer的信息,请参阅文档网站https://hyperledger.github.io/composer/,请确保卸载php的依赖管理器(称为composer)。