You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Ubuntu 16.04与Linux Mint 21运行Hyperledger Caliper基准测试报错求助

Hyperledger Caliper执行基准测试报错:无法检测所需Fabric绑定包

问题场景

在Ubuntu 16.04和Linux Mint 21系统上使用Hyperledger Caliper执行区块链基准测试,已安装Node.js和npm,执行命令如下:

npx caliper launch manager \
--caliper-workspace . \
--caliper-benchconfig benchmarks/scenario/simple/config.yaml \
--caliper-networkconfig networks/fabric/test-network.yaml

错误日志

chahrazed@chahrazed-Lenovo-ideapad-110-15ISK:~/Bureau/caliper/caliper-benchmarks$ sudo caliper launch manager     --caliper-workspace .     --caliper-benchconfig benchmarks/scenario/simple/config.yaml     --caliper-networkconfig networks/fabric/test-network.yaml
2023.03.25-11:02:12.398 info  [caliper] [cli-launch-manager]    Set workspace path: /home/chahrazed/Bureau/caliper/caliper-benchmarks
2023.03.25-11:02:12.399 info  [caliper] [cli-launch-manager]    Set benchmark configuration path: /home/chahrazed/Bureau/caliper/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2023.03.25-11:02:12.400 info  [caliper] [cli-launch-manager]    Set network configuration path: /home/chahrazed/Bureau/caliper/caliper-benchmarks/networks/fabric/test-network.yaml
2023.03.25-11:02:12.400 info  [caliper] [cli-launch-manager]    Set SUT type: fabric
2023.03.25-11:02:12.409 info  [caliper] [benchmark-validator]   No observer specified, will default to `none`
2023.03.25-11:02:12.409 info  [caliper] [caliper-engine]        Starting benchmark flow
2023.03.25-11:02:12.410 info  [caliper] [caliper-engine]        Network configuration attribute "caliper.command.start" is not present, skipping start command
2023.03.25-11:02:12.458 error [caliper] [caliper-engine]        Error while performing "test" step: Error: Unable to detect required Fabric binding packages
    at _determineInstalledNodeSDKandVersion (/usr/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:60:15)
    at CaliperEngine.connectorFactory [as adapterFactory] (/usr/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:132:17)
    at CaliperEngine.run (/usr/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:109:64)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Function.handler (/usr/lib/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:30)
2023.03.25-11:02:12.459 info  [caliper] [caliper-engine]        Network configuration attribute "caliper.command.end" is not present, skipping end command
2023.03.25-11:02:12.459 error [caliper] [cli-launch-manager]    Benchmark failed with error code 6
Usage:
 caliper launch manager --caliper-bind-sut fabric:2.2 [other options]

Options:
  --help, -h           Show usage information  [booléen]
  --version            Show version information  [booléen]
  --caliper-bind-sut   The name and version of the platform to bind to  [chaîne de caractères]
  --caliper-bind-cwd   The working directory for performing the SDK install  [chaîne de caractères]
  --caliper-bind-args  Additional arguments to pass to "npm install". Use the "=" notation when setting this parameter  [chaîne de caractères]
  --caliper-bind-file  Yaml file to override default (supported) package versions when binding an SDK  [chaîne de caractères]

Error: Benchmark failed with error code 6
    at Function.handler (/usr/lib/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:70:23)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

补充环境信息

  • Ubuntu 16.04:Node.js v14.21.1,npm v9.6.2
  • Linux Mint 21 Cinnamon:Node.js v12.22.9,npm v8.19.3

解决方法

1. 绑定对应版本的Fabric SDK

错误日志明确提示需要指定--caliper-bind-sut参数绑定Fabric版本。先确认你的Fabric网络版本(比如常见的2.2、1.4),然后修改启动命令,添加绑定参数:

npx caliper launch manager \
--caliper-workspace . \
--caliper-benchconfig benchmarks/scenario/simple/config.yaml \
--caliper-networkconfig networks/fabric/test-network.yaml \
--caliper-bind-sut fabric:2.2

注:将fabric:2.2替换为你实际使用的Fabric版本

2. 避免使用sudo执行Caliper命令

sudo会改变命令执行的环境变量和权限,可能导致依赖包安装路径异常,直接用普通用户权限执行即可。如果之前用sudo安装过依赖,建议清理后重新安装:

# 清理npm缓存
npm cache clean --force
# 进入工作目录,重新绑定Fabric SDK
cd ~/Bureau/caliper/caliper-benchmarks
npx caliper bind --caliper-bind-sut fabric:2.2 --caliper-bind-cwd .

3. 调整Node.js版本兼容

  • Ubuntu 16.04上的Node.js 14.x符合Fabric 2.2的要求,无需调整
  • Linux Mint 21上的Node.js 12.x版本偏低,Fabric 2.2推荐Node.js 14.x或16.x,建议用nvm升级Node.js版本:
# 安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# 重启终端后安装Node.js 14
nvm install 14
nvm use 14

内容的提问来源于stack exchange,提问作者Chahrazex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 17:17:53