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閱讀 229,001評論 6 537
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 98,786評論 3 423
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 176,986評論 0 381
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,204評論 1 315
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,964評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,354評論 1 324
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,410評論 3 444
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,554評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,106評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,918評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,093評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,648評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,342評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,755評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,009評論 1 289
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,839評論 3 395
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,107評論 2 375

推薦閱讀更多精彩內容