Calanais
Calanais

Reputation: 1590

Running the 'Getting-Started' Fabric Composer gets error with composer archive create; missing required options

Sequence of steps was

Lots of NPM errors are output, but some of the key ones are.

> composer archive create -m digitalproperty-network  --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna  --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d

composer archive create --archiveFile digitialPropertyNetwork.zip --sourceType module --sourceName digitalproperty-network

Options:
  --help             Show help  [boolean]
  -v, --version      Show version number  [boolean]
  --archiveFile, -a  Business network archive file name. Default is based on the Identifier of the BusinessNetwork  [string]
  --sourceType, -t   The type of the input containg the files used to create the archive [ module | dir ]  [required]
  --sourceName, -n   The Location to create the archive from e.g. NPM module directory or Name of the npm module to use  [required]

Missing required arguments: sourceType, sourceName

npm ERR! Linux 4.8.0-39-generic
npm ERR! argv "/home/matthew/.nvm/versions/node/v6.10.0/bin/node" "/home/matthew/.nvm/versions/node/v6.10.0/bin/npm" "run" "deployNetwork"
npm ERR! node v6.10.0
npm ERR! npm  v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deployNetwork: `composer archive create -m digitalproperty-network  --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna  --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d`
npm ERR! Exit status 1

The machine is clean, with no caches. Some of the other sample networks are also failing with the same error?

Upvotes: 1

Views: 858

Answers (1)

Calanais
Calanais

Reputation: 1590

When the npm install -g composer-cli was issued, it installed a version of the command line tools that was at v0.4.5 or later. composer --version outputs for example.

$ composer --version
composer-cli                   v0.4.5
composer-admin                 v0.4.5
composer-client                v0.4.5
composer-common                v0.4.5
composer-runtime-hlf           v0.4.5
composer-connector-hlf         v0.4.5

The composer archive create command needs to form up the Business Network Archive from the model files, transaction files etc. It can do this in two ways

  • by taking a source directory
  • by taking a module name

The new syntax of the command is

composer archive create --archiveFile digitialPropertyNetwork.zip --sourceType module --sourceName digitalproperty-network

Options:
  --help             Show help  [boolean]
  -v, --version      Show version number  [boolean]
  --archiveFile, -a  Business network archive file name. Default is based on the Identifier of the BusinessNetwork  [string]
  --sourceType, -t   The type of the input containg the files used to create the archive [ module | dir ]  [required]
  --sourceName, -n   The Location to create the archive from e.g. NPM module directory or Name of the npm module to use  [required]

Previously there was a --moduleName and a --inputDir name.

Examples:

To create a business network archive from the current working directory previously would have used the --inputDir . the new command is:

composer archive create --sourceType dir --sourceName . --archiveFile digitialPropertyNetwork.bna

To create a business network archive by indicating the NPM Module containing the business network would have used the --moduleName digitalproperty-network the new command is:

composer archive create --sourceType module --sourceName digitialproperty-network --archiveFile digitialPropertyNetwork.bna

In both cases above the --archiveFile digitialPropertyNetwork.bna is optional. A default filename will be created from the name of the Business Network if needed.

Why?

The inputDir and moduleName options were mutually exclusive and the internal code design was not proving resilient to handling error cases. The new approach to the options simplifies (and increases the resilience of the code).

Depending on the development approach, the artifacts that make up the business network may be created in different ways. By moving to this new style of options means we aren't precluding any other 'sourceType'. In the previous model, we would have had to add more and more command line options.

Upvotes: 1

Related Questions