node.jsnpmnode-modulescaliperhyperledger-caliper

Error while executing Hyperledger Caliper benchmark on Ubuntu 16.04 and Linux Mint 21


I'm trying to execute a benchmark using Hyperledger Caliper on Ubuntu 16.04 and also on Linux Mint 21. I have installed Node.js and npm, and am running the command:

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

However, I'm encountering the following error:

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)

I have tried installing and using different versions of Node.js and npm, but the issue persists. Can someone please help me understand what might be causing this error and how to resolve it?

Additional information:

Thank you in advance for your help.


Solution

  • Looks like you didn't bind an SDK to caliper. If you are using fabric 2.4 or higher then use

    npx caliper bind --caliper-bind-sut fabric:2.4

    to bind with the new fabric node sdk which uses the new peer gateway service.

    If you are using an older version of fabric than 2.4 then you can bind to the older legacy node sdk using

    npx caliper bind --caliper-bind-sut fabric:2.2

    Note that binding to 2.2 will still work with fabric 2.4 and higher but the peer gateway service is the way to interact with fabric going forward.