Mac OS搭建Hyperledger Fabric官方Demo一

Demo地址

在尝试Demo的时候遇到了不少坑,这里记录一下:

问题一

在执行./startFabric.sh时报错ERROR: manifest for hyperledger/fabric-couchdb:latest not found

# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1

docker-compose -f docker-compose.yml down
Removing network net_basic

docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com peer0.org1.example.com couchdb
Creating network "net_basic" with the default driver
Pulling couchdb (hyperledger/fabric-couchdb:latest)...
ERROR: manifest for hyperledger/fabric-couchdb:latest not found

解决办法

查了一下,貌似是没有配置Hyperledger Fabric Samples的工具库

问题二

按照Hyperledger Fabric Samples的教程,在执行curl -sSL https://goo.gl/Gci9ZX | bash时,卡死了,和可能是网络问题;

解决办法:

在浏览器里打开https://goo.gl/Gci9ZX,其代码如下

#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

export VERSION=1.0.2
export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
#Set MARCH variable i.e ppc64le,s390x,x86_64,i386
MARCH=`uname -m`

dockerFabricPull() {
  local FABRIC_TAG=$1
  for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do
      echo "==> FABRIC IMAGE: $IMAGES"
      echo
      docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
      docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
  done
}

dockerCaPull() {
      local CA_TAG=$1
      echo "==> FABRIC CA IMAGE"
      echo
      docker pull hyperledger/fabric-ca:$CA_TAG
      docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
}

: ${CA_TAG:="$MARCH-$VERSION"}
: ${FABRIC_TAG:="$MARCH-$VERSION"}

echo "===> Downloading platform binaries"
curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz

echo "===> Pulling fabric Images"
dockerFabricPull ${FABRIC_TAG}

echo "===> Pulling fabric ca Image"
dockerCaPull ${CA_TAG}
echo
echo "===> List out hyperledger docker images"
docker images | grep hyperledger*

将代码复制到fabric-samples/init.sh,然后运行
./init.sh
开始自动下载需要的docker image,网速不给力,这里需要较长时间,可以给Docker配置代理,配置代理教程

iMacdeiMac-2:fabric-samples imactwo$ ./init.sh 
===> Downloading platform binaries
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.5M  100 22.5M    0     0   257k      0  0:01:29  0:01:29 --:--:--  248k
===> Pulling fabric Images
==> FABRIC IMAGE: peer

x86_64-1.0.2: Pulling from hyperledger/fabric-peer
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
51fc526ed766: Already exists 
e0386e9ee7cf: Pull complete 
a75d8afcee28: Pull complete 
Digest: sha256:ce6e3c3d0f71641020184e4fe0615c2e65b5181664bad3d05942091917b73e28
Status: Downloaded newer image for hyperledger/fabric-peer:x86_64-1.0.2
==> FABRIC IMAGE: orderer

x86_64-1.0.2: Pulling from hyperledger/fabric-orderer
Digest: sha256:6427715d8c56b8778de30c7895287d0dd7bb9adb2f895337aac2dd3d0dcabca7
Status: Downloaded newer image for hyperledger/fabric-orderer:x86_64-1.0.2
==> FABRIC IMAGE: couchdb

x86_64-1.0.2: Pulling from hyperledger/fabric-couchdb
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Pull complete 
9767b1c8440b: Pull complete 
b9b680c73863: Pull complete 
910808d7b46d: Pull complete 
b2b400af2b65: Pull complete 
656c0e3d1026: Pull complete 
fd537a07cc88: Pull complete 
fb80790f85e2: Pull complete 
6b4be879a573: Pull complete 
24e26e38b19c: Pull complete 
ba4d4ddd242e: Pull complete 
Digest: sha256:5364d4f3e0844455195cc82626675cf01a873ba3b762d156efffb239740c2415
Status: Downloaded newer image for hyperledger/fabric-couchdb:x86_64-1.0.2
==> FABRIC IMAGE: ccenv

x86_64-1.0.2: Pulling from hyperledger/fabric-ccenv
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Already exists 
9767b1c8440b: Already exists 
b9b680c73863: Already exists 
166a55562f41: Pull complete 
3d603cc86908: Pull complete 
5e68f74a4f28: Pull complete 
Digest: sha256:3ad83a302e633dea8fa3d9d95b3e68919b7754d81bd521d1c3744bd251d5a526
Status: Downloaded newer image for hyperledger/fabric-ccenv:x86_64-1.0.2
==> FABRIC IMAGE: javaenv

x86_64-1.0.2: Pulling from hyperledger/fabric-javaenv
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Already exists 
9767b1c8440b: Already exists 
b9b680c73863: Already exists 
f27ca7df950b: Pull complete 
6bdffd82de79: Pull complete 
b049ece410a1: Pull complete 
d6a291b77d29: Pull complete 
7cb4541e382f: Pull complete 
b31b833bb285: Pull complete 
643fd0d667f7: Pull complete 
935ca4c299df: Pull complete 
Digest: sha256:3cfb1ccb0b17e58a2a903a68959aa25e53dd3eaeefccd969944efd4b766541aa
Status: Downloaded newer image for hyperledger/fabric-javaenv:x86_64-1.0.2
==> FABRIC IMAGE: kafka

x86_64-1.0.2: Pulling from hyperledger/fabric-kafka
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Already exists 
9767b1c8440b: Already exists 
b9b680c73863: Already exists 
acb25f369ac3: Pull complete 
16930d8f4113: Pull complete 
4641f537b20c: Pull complete 
Digest: sha256:ebbfd837ed010eac27007b7203074d3621969431e07fd6a874dc4c057bfbf0a2
Status: Downloaded newer image for hyperledger/fabric-kafka:x86_64-1.0.2
==> FABRIC IMAGE: zookeeper

x86_64-1.0.2: Pulling from hyperledger/fabric-zookeeper
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Already exists 
9767b1c8440b: Already exists 
b9b680c73863: Already exists 
44885f365644: Pull complete 
46ece701894d: Pull complete 
2d416318c4a3: Pull complete 
f65b80d465e8: Pull complete 
Digest: sha256:ef981366251ad87d20f2d6de85f1c3524dd31d3551e6f53274925066c5b1d849
Status: Downloaded newer image for hyperledger/fabric-zookeeper:x86_64-1.0.2
==> FABRIC IMAGE: tools

x86_64-1.0.2: Pulling from hyperledger/fabric-tools
d5c6f90da05d: Already exists 
1300883d87d5: Already exists 
c220aa3cfc1b: Already exists 
2e9398f099dc: Already exists 
dc27a084064f: Already exists 
87675a6d4030: Already exists 
93e601aafda8: Already exists 
6be6b5cbce6b: Already exists 
c90d7a44426d: Already exists 
9767b1c8440b: Already exists 
b9b680c73863: Already exists 
0cb2dbc2f8a2: Pull complete 
05edc6c8e54b: Pull complete 
1a8edd3b0b2a: Pull complete 
579fce528924: Pull complete 
0c728eabbff4: Pull complete 
Digest: sha256:9323ebacecc60f20562a49de201bd0a8b7852d3d9349a8916a66df1203fd38b0
Status: Downloaded newer image for hyperledger/fabric-tools:x86_64-1.0.2
===> Pulling fabric ca Image
==> FABRIC CA IMAGE

x86_64-1.0.2: Pulling from hyperledger/fabric-ca
aafe6b5e13de: Pull complete 
0a2b43a72660: Pull complete 
18bdd1e546d2: Pull complete 
8198342c3e05: Pull complete 
f56970a44fd4: Pull complete 
e32b597e7839: Pull complete 
a6e362fc71c4: Pull complete 
b42cff702f8a: Pull complete 
fd742d0d9134: Pull complete 
1af663083463: Pull complete 
aeef9e452233: Pull complete 
Digest: sha256:25ab46a951c17b3034b3555b339ba4a985148668959f96152a1e91bbd1c7dd57
Status: Downloaded newer image for hyperledger/fabric-ca:x86_64-1.0.2

===> List out hyperledger docker images
hyperledger/fabric-ca                               latest              7e53be14f804        10 days ago         238 MB
hyperledger/fabric-ca                               x86_64-1.0.2        7e53be14f804        10 days ago         238 MB
hyperledger/fabric-tools                            latest              ba9750b2565d        10 days ago         1.33 GB
hyperledger/fabric-tools                            x86_64-1.0.2        ba9750b2565d        10 days ago         1.33 GB
hyperledger/fabric-couchdb                          latest              3f922f54bd68        10 days ago         1.47 GB
hyperledger/fabric-couchdb                          x86_64-1.0.2        3f922f54bd68        10 days ago         1.47 GB
hyperledger/fabric-kafka                            latest              0b4b1d249e65        10 days ago         1.29 GB
hyperledger/fabric-kafka                            x86_64-1.0.2        0b4b1d249e65        10 days ago         1.29 GB
hyperledger/fabric-zookeeper                        latest              1efb063147d3        10 days ago         1.3 GB
hyperledger/fabric-zookeeper                        x86_64-1.0.2        1efb063147d3        10 days ago         1.3 GB
hyperledger/fabric-orderer                          latest              6efd17e86e65        10 days ago         151 MB
hyperledger/fabric-orderer                          x86_64-1.0.2        6efd17e86e65        10 days ago         151 MB
registry.docker-cn.com/hyperledger/fabric-orderer   x86_64-1.0.2        6efd17e86e65        10 days ago         151 MB
hyperledger/fabric-peer                             latest              0e2ed51971c9        10 days ago         154 MB
hyperledger/fabric-peer                             x86_64-1.0.2        0e2ed51971c9        10 days ago         154 MB
hyperledger/fabric-javaenv                          latest              0be45dbd7ff4        10 days ago         1.41 GB
hyperledger/fabric-javaenv                          x86_64-1.0.2        0be45dbd7ff4        10 days ago         1.41 GB
hyperledger/fabric-ccenv                            latest              d0f166e1a89e        10 days ago         1.28 GB
hyperledger/fabric-ccenv                            x86_64-1.0.2        d0f166e1a89e        10 days ago         1.28 GB

问题三

在npm install 时,因为使用了node版本管理器n,报错如下:

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'


   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.0.0 → 5.4.1    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯


npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/imactwo/.npm/_logs/2017-09-12T05_37_44_321Z-debug.log

解决办法

此时node版本为8.0.0,先用n将node版本改为6.2.2,再使用npm i -g npm安装最新版的npm

问题四

https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html上有如下提示:

屏幕快照 2017-09-12 下午2.40.00.png

使用n安装node 6.9.5,因为网络问题,下载特别慢,查到这个博客,配置加速来提高下载速度

PROJECT_NAME="node" PROJECT_URL="https://npm.taobao.org/mirrors/node/" n project 6.9.5
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,458评论 4 363
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,454评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,171评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,062评论 0 207
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,440评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,661评论 1 219
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,906评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,609评论 0 200
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,379评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,600评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,085评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,409评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,072评论 3 237
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,088评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,860评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,704评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,608评论 2 270

推荐阅读更多精彩内容