0

I am new to TronGrid.js and node.js. When I execute this file through cmd using node index.js it works fine... but, when I load the same file in an aspx file as script, it gives the following error:

Uncaught ReferenceError: require is not defined

Here is my index.js

const TRONGRID = require("trongrid");
const TRONWEB = require("tronweb");
    const tronWeb = new TRONWEB({
        fullHost: "https://api.shasta.trongrid.io/"
    });

    const tronGrid = new TRONGRID(tronWeb);

    async function getTransactions() {

        let options = {
            onlyTo: true
        };

        var transactions = await tronGrid.account.getTransactions("TJqfBdPgRHbFpWz7epwq3LGzrxtNyzWTTQ", options);

        console.log(transactions);
    }

    getTransactions();
Adrian Mole
  • 43,040
  • 110
  • 45
  • 72
Abhishek Pandey
  • 141
  • 2
  • 10
  • Does this answer your question? [Client on node: Uncaught ReferenceError: require is not defined](https://stackoverflow.com/questions/19059580/client-on-node-uncaught-referenceerror-require-is-not-defined) – Damian Dziaduch Sep 28 '20 at 12:14

0 Answers0