Search code examples
javascriptnode.jshyperledger-fabrichyperledger

Use Node.js version 16 for chaincode execution


I'm running JavaScript/TypeScript chaincode from fabric-samples (asset-transfer-basic/chaincode-javascript) and I need the Node.js version to be 16 instead of 12.

I think that what is setting the Node.js version to 12.16.1 is the hyperledger/fabric-nodeenv image, but I don't know how can I change it. https://hub.docker.com/layers/fabric-nodeenv/hyperledger/fabric-nodeenv/2.4.1/images/sha256-53ec564ee28ed1fcee3be9ed1459bcc98a22fc0d81e5a707239425615641786a?context=explore

The documentation says that v2.4 modules use version 16.4.0 of Node.js and versions v2.2/2.3, 12.16.1. But I'm using the latest version of Fabric (2.4.2). https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md

I use ./network.sh deployCC to deploy the chaincode.


Solution

  • Solved it by creating and uploading an updated version of fabric-nodeenv image (https://github.com/hyperledger/fabric-chaincode-node/tree/main/docker/fabric-nodeenv) and defining the CORE_CHAINCODE_NODE_RUNTIME env var in fabric-samples/test-network/compose/compose-test-net.yaml