Hyperledger fabric环境搭建中遇到的问题 Mac

古城微笑少年丶 2022-04-18 05:50 374阅读 0赞

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

当时报错为:

  1. ~/go/src/marbles/fabric-samples/fabcar 94c21eb sudo npm install
  2. Password:
  3. > grpc@1.14.2 install /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/fabric-client/node_modules/grpc
  4. > node-pre-gyp install --fallback-to-build --library=static_library
  5. node-pre-gyp WARN Using request for node-pre-gyp https download
  6. [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
  7. > pkcs11js@1.0.16 install /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/pkcs11js
  8. > node-gyp rebuild
  9. xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
  10. xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
  11. Traceback (most recent call last):
  12. 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>
  13. sys.exit(gyp.script_main())
  14. 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
  15. return main(sys.argv[1:])
  16. 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
  17. return gyp_main(args)
  18. 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
  19. generator.GenerateOutput(flat_list, targets, data, params)
  20. 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
  21. part_of_all=qualified_target in needed_targets)
  22. 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
  23. self.Pchify))
  24. 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
  25. cflags = self.xcode_settings.GetCflags(configname)
  26. 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
  27. archs = self.GetActiveArchs(self.configname)
  28. 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
  29. xcode_archs_default = GetXcodeArchsDefault()
  30. 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
  31. xcode_version, _ = XcodeVersion()
  32. 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
  33. version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
  34. AttributeError: 'NoneType' object has no attribute 'groups'
  35. gyp ERR! configure error
  36. gyp ERR! stack Error: `gyp` failed with exit code: 1
  37. 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)
  38. gyp ERR! stack at emitTwo (events.js:106:13)
  39. gyp ERR! stack at ChildProcess.emit (events.js:191:7)
  40. gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
  41. gyp ERR! System Darwin 18.2.0
  42. 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"
  43. gyp ERR! cwd /Users/grootma/go/src/marbles/fabric-samples/fabcar/node_modules/pkcs11js
  44. gyp ERR! node -v v6.11.1
  45. gyp ERR! node-gyp -v v3.4.0
  46. gyp ERR! not ok
  47. fabcar@1.0.0 /Users/grootma/go/src/marbles/fabric-samples/fabcar
  48. └── (empty)
  49. npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none was installed.
  50. npm WARN fabcar@1.0.0 No repository field.
  51. npm ERR! Darwin 18.2.0
  52. 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"
  53. npm ERR! node v6.11.1
  54. npm ERR! npm v3.10.10
  55. npm ERR! code ELIFECYCLE
  56. npm ERR! pkcs11js@1.0.16 install: `node-gyp rebuild`
  57. npm ERR! Exit status 1
  58. npm ERR!
  59. npm ERR! Failed at the pkcs11js@1.0.16 install script 'node-gyp rebuild'.
  60. npm ERR! Make sure you have the latest version of node.js and npm installed.
  61. npm ERR! If you do, this is most likely a problem with the pkcs11js package,
  62. npm ERR! not with npm itself.
  63. npm ERR! Tell the author that this fails on your system:
  64. npm ERR! node-gyp rebuild
  65. npm ERR! You can get information on how to open an issue for this project with:
  66. npm ERR! npm bugs pkcs11js
  67. npm ERR! Or if that isn't available, you can get their info via:
  68. npm ERR! npm owner ls pkcs11js
  69. npm ERR! There is likely additional logging output above.
  70. npm ERR! Please include the following file with any support request:
  71. npm ERR! /Users/grootma/go/src/marbles/fabric-samples/fabcar/npm-debug.log
  72. npm ERR! code 1

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

  1. sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

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

  1. /Applications/Xcode.app/Contents/Developer sudo npm install
  2. npm WARN enoent ENOENT: no such file or directory, open '/Applications/Xcode.app/Contents/Developer/package.json'
  3. npm WARN Developer No description
  4. npm WARN Developer No repository field.
  5. npm WARN Developer No README data
  6. 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)

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NhcHRhaW5KYXZh_size_16_color_FFFFFF_t_70/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下,再次启动即可。

发表评论

表情:
评论列表 (有 0 条评论,374人围观)

还没有评论,来说两句吧...

相关阅读