您的位置:首页 > 其它

Hyperledger fabric环境搭建终于到的问题 Mac

2018-11-09 11:53 477 查看

1、node安装参考https://blog.csdn.net/CaptainJava/article/details/83866880

2、在搭建fabric IBM Marbles环境,在marbles/fabric-samples/fabcar下执行sudo npm install时node gyp安装报错

gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1

但是一直在找这个报错,也没有解决。其实是找错问题了,gyp固然是安装失败了 但是失败的原因在这个报错的前边几句,

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

当时报错为: 

[code] ~/go/src/marbles/fabric-samples/fabcar  ➦ 94c21eb  sudo npm install
Password:

> grpc@1.14.2 install /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
[grpc] Success: "/Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node" is installed via remote

> pkcs11js@1.0.16 install /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/pkcs11js
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Traceback (most recent call last):
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
return gyp_main(args)
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2170, in GenerateOutput
part_of_all=qualified_target in needed_targets)
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 795, in Write
self.Pchify))
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1190, in WriteSources
cflags = self.xcode_settings.GetCflags(configname)
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 551, in GetCflags
archs = self.GetActiveArchs(self.configname)
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 420, in GetActiveArchs
xcode_archs_default = GetXcodeArchsDefault()
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
xcode_version, _ = XcodeVersion()
File "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1265, in XcodeVersion
version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/bin/node" "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/pkcs11js
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
fabcar@1.0.0 /Users/grootma/go/src/marbles/fabric-samples/fabcar
└── (empty)

npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none was installed.
npm WARN fabcar@1.0.0 No repository field.
npm ERR! Darwin 18.2.0
npm ERR! argv "/usr/local/Cellar/nvm/0.33.11/versions/node/v6.11.1/bin/node" "/usr/local/opt/nvm/versions/node/v6.11.1/bin/npm" "install"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! pkcs11js@1.0.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js@1.0.16 install script 'node-gyp rebuild'.
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 pkcs11js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pkcs11js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pkcs11js
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/grootma/go/src/marbles/fabric-samples/fabcar/npm-debug.log
npm ERR! code 1

是xcode 命令行工具的问题,在这我们重新设置一下xcode路径就好了(后边路径要去确认一下自己的xcode路径)

[code]sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

注意:当时设置完了,接着执行npm install时报错了 新的错误,

[code] /Applications/Xcode.app/Contents/Developer  sudo npm install
npm WARN enoent ENOENT: no such file or directory, open '/Applications/Xcode.app/Contents/Developer/package.json'
npm WARN Developer No description
npm WARN Developer No repository field.
npm WARN Developer No README data
npm WARN Developer No license field.

当时正好有事情就所有然见关掉,关机了,第二天打开电脑重新进行sudo npm install的时候结果成功了。没有在报错。所以肯呢个需要重启一下某些工具或者xcode。具体不清楚,反正我是重启电脑后就好了。。。如果有更好的解释或者更好的方法希望留言告知。

3、node install_chaincode.js 出现 Error('Cannot find org.', orgName):

root@xg:/opt/gopath/src/github.com/hyperledger/marbles/scripts# node install_chaincode.js 
info: Loaded config file /opt/gopath/src/github.com/hyperledger/marbles/config/marbles_local.json
info: Loaded connection profile file /opt/gopath/src/github.com/hyperledger/marbles/config/connection_profile_local.json

Connection Profile Lib Functions:()
......
  getAdminSignedCertPEM()
---------------------------------------
info: Lets install some chaincode - marbles v4
---------------------------------------
info: First we enroll
/opt/gopath/src/github.com/hyperledger/marbles/utils/connection_profile_lib/parts/org.js:102
        throw new Error('Cannot find org.', orgName);
        ^
Error: Cannot find org.

该问题是由于 marbles\config\connection_profile_local.json中的 hfc-key-store 的绝对路径不正确导致的,需要更改是实际路径

(解决方法参考的:https://blog.csdn.net/u011127242/article/details/83450015

/Users/grootma/go/src/marbles/config/connection_profile_local.json文件中,三处"path"的值替换为Marble项目所在的绝对路径,只改前半部分后边不改动。即可。

4、在启动marbles服务,gulp marbles_local时报错

error: [Client.js]: Failed to load user "admin" from local key value store. Error: Error: Private key missing from key store. Can not establish the signing identity for user admin

错误,没找到admin用户的私钥,

将/Users/grootma/go/src/marbles/fabric-samples/fabcar/hfc-key-store文件夹下的文件复制到~/.hfc-key-store下,再次启动即可。

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: