Search code examples
hyperledger-composer

How to import modules to hyperledger-composer?


I use hyperledger-composer and in the 1lib/logic.js1, at the top, i typed require('axios') but when i try to install my network in the composer, i get this error: ReferrenceError: 'require' not defined or not defined...

So, please, can you help me to import modules in this file? it could permit me to store my data in a big data as hadoop after transaction validated


Solution

  • Composer doesn't support the ability to require modules in transaction processor functions. Given that Hyperledger Composer is deprecated I would recommend you go straight to using node.js chaincode in hyperledger fabric which will allow you to include other npm modules (hyperledger composer was, in part, a node.js chaincode runtime to use in conjunction with hyperledger fabric). Would suggest looking at https://hyperledger-fabric.readthedocs.io/en/release-1.4/write_first_app.html