Fabric Composer Quickstart error

2019-09-08 11:39发布

问题:

I'm having problems with 'npm install' step in the the Fabric Composer Quickstart guide -- https://fabric-composer.github.io/installing/quickstart.html

My system levels are:

Ubuntu 16.04 LTS Docker version 1.12.6, build 78d1802 docker-compose version 1.12.0-rc2, build 08dc2a4 node v6.9.4 git 2.7.4

I installed the command line tools: npm install -g composer-cli

Cloned the sample apps repository: git clone https://github.com/fabric-composer/sample-applications.git

cd'ed to the sample apps dir: cd sample-applications/packages/getting-started

ran 'npm install' where I got the following error in the Deploying business network from archive digitalPropertyNetwork.bna step:

... Found: Description:Digital Property Network Name:digitalproperty-network Identifier:digitalproperty-network@0.0.6

Written Business Network Definition Archive file to digitalPropertyNetwork.bna Command completed successfully. Deploying business network from archive digitalPropertyNetwork.bna Business network definition: Identifier: digitalproperty-network@0.0.6 Description: Digital Property Network events.js:160 throw er; // Unhandled 'error' event ^

Error at ClientDuplexStream._emitStatusIfDone (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:189:19) at ClientDuplexStream._readsDone (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:158:8) at readCallback (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:217:12)

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! getting-started@1.0.0 deployNetwork: composer archive create --sourceName digitalproperty-network --sourceType module --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 npm ERR! npm ERR! Failed at the getting-started@1.0.0 deployNetwork script 'composer archive create --sourceName digitalproperty-network --sourceType module --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! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the getting-started package, npm ERR! not with npm itself. ...

Any ideas?


none of the ports which appear to be used by the fabric containers (7050-7054) are in use prior to running nps install according to netstat -a.

I'm attaching the full output from 'npm install' along with the 'docker ps' command result after it runs:

bill@bill-ubuntu:~/blockchain-fabric-composer/sample-applications/packages/getting-started$ npm install

> getting-started@1.0.0 preinstall /home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started
> composer --version || echo 'Please first run npm install -g composer-cli' 

composer-cli                   v0.5.6
composer-admin                 v0.5.6
composer-client                v0.5.6
composer-common                v0.5.6
composer-runtime-hlf           v0.5.6
composer-connector-hlf         v0.5.6


> getting-started@1.0.0 install /home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started
> scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork


# Grab the current directory.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
 cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd 
 dirname "${BASH_SOURCE[0]}" 

# Shut down the Docker containers that might be currently running.
cd "${DIR}"/scripts
docker-compose kill && docker-compose down
Removing scripts_vp0_1 ... done
Removing scripts_membersrvc_1 ... done

# TODO change this to alter the default profile which is, by convention, a local running hyperledger fabric
rm -rf ~/.composer-connection-profiles/defaultProfile/*
rm -rf ~/.composer-credentials/*


# delete all existing containers and images
# This is not used in general usage but this might
#read -p "Press y to delete all docker containers images" -n 1 -r
#echo    # (optional) move to a new line
#if [[ $REPLY =~ ^[Yy]$ ]]
#then
#  docker rm $(docker ps -a -q) -f
#  docker rmi $(docker images -q) -f
#fi

# Pull and tag the latest Hyperledger Fabric base image.
docker pull hyperledger/fabric-baseimage:x86_64-0.1.0
x86_64-0.1.0: Pulling from hyperledger/fabric-baseimage
Digest: sha256:ac6a2784cfd028ae62f5688f4436f95d7a60eeacd8506eb303c9c6335328c388
Status: Image is up to date for hyperledger/fabric-baseimage:x86_64-0.1.0
docker tag hyperledger/fabric-baseimage:x86_64-0.1.0 hyperledger/fabric-baseimage:latest

# Grab the current directorydirectory.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
 cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd 
 dirname "${BASH_SOURCE[0]}" 

#
cd "${DIR}"/scripts

# Start up the Hyperledger Fabric
docker-compose up -d --build
Creating scripts_membersrvc_1
Creating scripts_vp0_1


# Wait for the Hyperledger Fabric to start.
while ! nc localhost 7051 </dev/null; do sleep 1; done
while ! nc localhost 7053 </dev/null; do sleep 1; done
while ! nc localhost 7054 </dev/null; do sleep 1; done
sleep 5

> getting-started@1.0.0 deployNetwork /home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started
> composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna && composer network deploy --archiveFile digitalPropertyNetwork.bna  --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d && composer network list -n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d

Creating Business Network Archive

Node module search path : 
undefined 

Looking for package.json of Business Network Definition in /home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/digitalproperty-network

Found:
Description:Digital Property Network
Name:digitalproperty-network
Identifier:digitalproperty-network@0.0.6

Written Business Network Definition Archive file to digitalPropertyNetwork.bna
Command completed successfully.
Deploying business network from archive digitalPropertyNetwork.bna
Business network definition:
    Identifier: digitalproperty-network@0.0.6
    Description: Digital Property Network
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error
    at ClientDuplexStream._emitStatusIfDone (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:189:19)
    at ClientDuplexStream._readsDone (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:158:8)
    at readCallback (/home/bill/blockchain-fabric-composer/sample-applications/packages/getting-started/node_modules/grpc/src/node/src/client.js:217:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! getting-started@1.0.0 deployNetwork: `composer archive create --sourceName digitalproperty-network --sourceType module --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
npm ERR! 
npm ERR! Failed at the getting-started@1.0.0 deployNetwork script 'composer archive create --sourceName digitalproperty-network --sourceType module --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! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     composer archive create --sourceName digitalproperty-network --sourceType module --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! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls getting-started
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bill/.npm/_logs/2017-04-08T23_44_23_838Z-debug.log
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! getting-started@1.0.0 install: `scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the getting-started@1.0.0 install script 'scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the getting-started package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     scripts/download-hyperledger.sh && scripts/start-hyperledger.sh && npm run deployNetwork
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs getting-started
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls getting-started
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bill/.npm/_logs/2017-04-08T23_44_23_862Z-debug.log

bill@bill-ubuntu:~/blockchain-fabric-composer/sample-applications/packages/getting-started$ docker ps

CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                    NAMES

24bb54c9fec3        hyperledger/fabric-membersrvc   "membersrvc"        14 seconds ago      Up 13 seconds       0.0.0.0:7054->7054/tcp   scripts_membersrvc_1

bill@bill-ubuntu:~/blockchain-fabric-composer/sample-applications/packages/getting-started$ 

including output from docker ps -s after running teardown.sh, download-hyperledger.sh, and start-hyperledger.sh:

CONTAINER ID        IMAGE                                                COMMAND                  CREATED             STATUS                      PORTS                    NAMES
fdccb0a2ce8c        hyperledger/fabric-peer                              "sh -c 'sleep 5; peer"   18 minutes ago      Exited (1) 18 minutes ago                            scripts_vp0_1
a9d625859d2b        hyperledger/fabric-membersrvc                        "membersrvc"             18 minutes ago      Up 18 minutes               0.0.0.0:7054->7054/tcp   scripts_membersrvc_1

and here is the output from docker logs for the failed peer container:

bill@bill-ubuntu:~/blockchain-fabric-composer/sample-applications/packages/getting-started/scripts$ docker logs fdccb0a2ce8c
21:43:33.321 [logging] LoggingInit -> DEBU 001 Setting default logging level to DEBUG for command 'node'
21:43:33.322 [peer] func1 -> INFO 002 Auto detected peer address: 172.18.0.3:7051
21:43:33.322 [peer] func1 -> INFO 003 Auto detected peer address: 172.18.0.3:7051
21:43:33.324 [eventhub_producer] AddEventType -> DEBU 004 registering BLOCK
21:43:33.325 [eventhub_producer] AddEventType -> DEBU 005 registering CHAINCODE
21:43:33.325 [eventhub_producer] AddEventType -> DEBU 006 registering REJECTION
21:43:33.325 [eventhub_producer] AddEventType -> DEBU 007 registering REGISTER
21:43:33.325 [nodeCmd] serve -> INFO 008 Security enabled status: true
21:43:33.325 [nodeCmd] serve -> INFO 009 Privacy enabled status: false
21:43:33.325 [eventhub_producer] start -> INFO 00a event processor started
21:43:33.325 [db] open -> DEBU 00b Is db path [/var/hyperledger/production/db] empty [true]
21:43:33.326 [db] open -> INFO 00c Setting rocksdb maxLogFileSize to 10485760
21:43:33.326 [db] open -> INFO 00d Setting rocksdb keepLogFileNum to 10
21:43:34.513 [nodeCmd] func1 -> DEBU 00e Registering validator with enroll ID: test_vp0
21:43:34.513 [crypto] RegisterValidator -> INFO 00f Registering validator [test_vp0] with name [test_vp0]...
21:43:34.517 [crypto] Debugf -> DEBU 010 [validator.test_vp0] Data will be stored at [/var/hyperledger/production/crypto/validator/test_vp0]
21:43:34.517 [crypto] Debugf -> DEBU 011 [validator.test_vp0] Keystore path [/var/hyperledger/production/crypto/validator/test_vp0/ks] missing [true]: [<clean>]
21:43:34.518 [crypto] Debugf -> DEBU 012 [validator.test_vp0] Creating Keystore at [/var/hyperledger/production/crypto/validator/test_vp0/ks]...
21:43:34.518 [crypto] Debug -> DEBU 013 [validator.test_vp0]  Open Keystore DB...
21:43:34.518 [crypto] Debug -> DEBU 014 [validator.test_vp0]  Ping Keystore DB...
21:43:34.519 [crypto] Debugf -> DEBU 015 [validator.test_vp0] Keystore created at [/var/hyperledger/production/crypto/validator/test_vp0/ks].
21:43:34.520 [crypto] Debugf -> DEBU 016 [validator.test_vp0] Keystore opened at [/var/hyperledger/production/crypto/validator/test_vp0/ks]...done
21:43:34.520 [crypto] Debug -> DEBU 017 [validator.test_vp0]  Registering node crypto engine...
21:43:34.520 [crypto] Debug -> DEBU 018 [validator.test_vp0]  Initiliazing TLS...
21:43:34.520 [crypto] Debug -> DEBU 019 [validator.test_vp0]  Initiliazing TLS...Disabled!!!
21:43:34.521 [crypto] Debug -> DEBU 01a [validator.test_vp0]  Getting ECA client...
21:43:34.521 [crypto] Debugf -> DEBU 01b [validator.test_vp0] Dial to addr:[membersrvc:7054], with serverName:[tlsca]...
21:43:34.521 [crypto] Debug -> DEBU 01c [validator.test_vp0]  TLS disabled...
21:43:34.521 [crypto] Debug -> DEBU 01d [validator.test_vp0]  Getting ECA client...done
21:43:34.522 [crypto] Errorf -> ERRO 01e [validator.test_vp0] Failed requesting read certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
21:43:34.522 [crypto] Errorf -> ERRO 01f [validator.test_vp0] Failed requesting ECA certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
21:43:34.523 [crypto] Errorf -> ERRO 020 [validator.test_vp0] Failed getting ECA certificate [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
21:43:34.523 [crypto] Errorf -> ERRO 021 [validator.test_vp0] Failed retrieving ECA certs chain [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
21:43:34.523 [crypto] Errorf -> ERRO 022 [validator.test_vp0] Failed registering node crypto engine [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
21:43:34.523 [crypto] Errorf -> ERRO 023 [validator.test_vp0] Failed registering peer [test_vp0]: [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure]
2017/04/09 21:43:34 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 172.18.0.2:7054: getsockopt: connection refused"; Reconnecting to {"membersrvc:7054" <nil>}
2017/04/09 21:43:34 Failed to dial membersrvc:7054: grpc: the connection is closing; please retry.
21:43:34.523 [crypto] Errorf -> ERRO 024 [validator.test_vp0] Failed registering [test_vp0]: [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure]
21:43:34.523 [crypto] RegisterValidator -> ERRO 025 Failed registering validator [test_vp0] with name [test_vp0] [rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure].
Error: rpc error: code = 14 desc = grpc: RPC failed fast due to transport failure
Usage:
  peer node start [flags]

Flags:
  -h, --help                help for start
      --peer-chaincodedev   Whether peer in chaincode development mode

Global Flags:
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
      --test.coverprofile string   Done (default "coverage.cov")
  -v, --version                    Display current version of fabric peer server

bill@bill-ubuntu:~/blockchain-fabric-composer/sample-applications/packages/getting-started/scripts$ 

回答1:

first time answering, so forgive my bad style I guess.

Anyway I had the same issue and in my case it was a matter of a slow computer. In other words the membersrvc was not up when the peer vp0 was trying to connect.

I fixed it by changing the start-hyperledger.sh script to sleep an extra 60 seconds just to be sure:

`# Wait for the Hyperledger Fabric to start.
while ! nc localhost 7051 </dev/null; do sleep 1; done
while ! nc localhost 7053 </dev/null; do sleep 1; done
while ! nc localhost 7054 </dev/null; do sleep 1; done
sleep 65
`

And also added some extra time before building the peer container in the composer file, docker-compose.yml:

`vp0:
  image: hyperledger/fabric-peer
  ports:
    - '7050:7050'
    - '7051:7051'
    - '7052:7052'
    - '7053:7053'
  environment:
    - CORE_PEER_ADDRESSAUTODETECT=true
    - CORE_VM_ENDPOINT=unix:///var/run/docker.sock
    - CORE_LOGGING_LEVEL=DEBUG
    - CORE_PEER_ID=vp0
    - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
    - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
    - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
    - CORE_SECURITY_ENABLED=true
    - CORE_SECURITY_ENROLLID=test_vp0
    - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
  links:
    - membersrvc
  command: sh -c 'sleep 25; peer node start'
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock`

Those two changes fixed it for me. So hope it helps



回答2:

Seems to be something network related: transport: dial tcp 172.18.0.2:7054: getsockopt: connection refused