Fabric Composer快速入门错误

时间:2017-04-06 20:16:32

标签: hyperledger-composer

我在Fabric Composer快速入门指南中遇到'npm install'步骤问题 - https://fabric-composer.github.io/installing/quickstart.html

我的系统级别是:

Ubuntu 16.04 LTS Docker版本1.12.6,版本78d1802 docker-compose版本1.12.0-rc2,build 08dc2a4 节点v6.9.4 git 2.7.4

我安装了命令行工具:     npm install -g composer-cli

克隆示例应用程序存储库:     git clone https://github.com/fabric-composer/sample-applications.git

cd到示例应用程序目录:     cd sample-applications / packages / getting-started

运行'npm install'我在存档digitalPropertyNetwork.bna步骤中部署业务网络时出现以下错误:

... 实测: 说明:数字财产网络 名称:digitalproperty网 标识符:digitalproperty-network@0.0.6

书面业务网络定义存档文件到digitalPropertyNetwork.bna 命令成功完成。 从存档digitalPropertyNetwork.bna部署业务网络 业务网络定义:     标识符:digitalproperty-network@0.0.6     说明:数字财产网络 events.js:160       扔掉//未处理的'错误'事件       ^

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

npm ERR!代码ELIFECYCLE 错误的ERR!错误1 错误的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 错误的ERR!退出状态1 错误的ERR! 错误的ERR!在getting-started@1.0.0上失败了deployNetwork脚本'composer archive create --sourceName digitalproperty-network --sourceType module --archiveFile digitalPropertyNetwork.bna&&作曲家网络部署--archiveFile digitalPropertyNetwork.bna --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d&&作曲家网络列表-n digitalproperty-network --enrollId WebAppAdmin --enrollSecret DJY27pEnl16d'。 错误的ERR!确保安装了最新版本的node.js和npm。 错误的ERR!如果这样做,这很可能是入门套餐的问题, 错误的ERR!不是与npm本身。 ...

有什么想法吗?

根据netstat -a,在运行nps安装之前,没有任何似乎由结构容器(7050-7054)使用的端口正在使用。

我在运行后附加'npm install'的完整输出以及'docker ps'命令结果:

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$ 
运行teardown.sh,download-hyperledger.sh和start-hyperledger.sh之后

包括docker ps -s的输出:

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

以下是失败的对等容器的docker日志输出:

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$ 

2 个答案:

答案 0 :(得分:1)

第一次回答,所以请原谅我糟糕的风格。

无论如何,我有同样的问题,在我的情况下,这是一个慢的电脑问题。换句话说,当对等vp0尝试连接时,membersrvc没有启动。

我通过更改start-hyperledger.sh脚本来修复它,以确保睡眠时间超过60秒:

`# 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
`

在构建文件中的peer容器之前还添加了一些额外的时间,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`

这两项修改为我解决了这个问题。所以希望它有所帮助

答案 1 :(得分:0)

似乎与网络相关:<div class="image_bg"> </div>