- Newest
- Most votes
- Most comments
The issue you're encountering is related to the way Node.js chaincode is packaged and deployed on Amazon Managed Blockchain (AMB). Due to security requirements, peer nodes in AMB don't have internet access, which means they can't download external dependencies at runtime when building or executing chaincode.
To resolve this, you need to bundle the Node.js chaincode with its dependencies before deploying. Here are some steps to help you solve this issue:
-
Navigate to the root directory of your chaincode (where the package.json file is located).
-
Run
npm installto install all the required dependencies. -
Move the node_modules directory to a new directory called 'lib':
mv node_modules/ lib -
Modify the start script in your package.json file to point to the new location of the dependencies:
"scripts": { "start": "NODE_PATH=lib fabric-chaincode-node start" } -
Package your chaincode manually in a tar.gz format, including the lib directory (which contains node_modules) and any other necessary files.
-
Use this manually created package to install, approve, and commit your chaincode using the Chaincode Lifecycle commands.
If you're using the fabric-contract-api or TypeScript, you might need to package the chaincode differently. In this case, you should manually create a package that includes the node_modules folder intact, along with your source code and a metadata.json file.
By bundling the dependencies with your chaincode, you ensure that all necessary modules, including fabric-chaincode-node, are available when the chaincode is executed on the peer node.
Sources
How bundle and commit Node.js chaincode on Amazon Managed Blockchain Hyperledger Fabric | AWS re:Post
How to bundle and commit Node.js chaincode on Amazon Managed Blockchain Hyperledger Fabric | AWS re:Post
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 2 years ago

I tried this. But it shows the same error messages. "sh: fabric-chaincode-node: not found". It seems to me that the file "fabric-chaincode-node" does not exist in the peer node. Did AWS change to omit javascript chaincode? The documentation has only for Java chaincode for special case. There is not document for javascript chaincode.