tronprotocol/tronweb

TypeError: TronWeb is not a constructor

masumetc opened this issue · 2 comments

i am getting this issue

TypeError: TronWeb is not a constructor
at Object. (D:\nodeprojects\index.js:3:17)
at Module._compile (node:internal/modules/cjs/loader:1368:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module._load (node:internal/modules/cjs/loader:1021:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49

in my index.js file looks like this

const TronWeb = require('tronweb');

const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  headers: { 'TRON-PRO-API-KEY': 'your api key' },
  privateKey: 'your private key'
});

It seems like you are using tronweb@6, please use const { TronWeb } = require('tronweb'). To know more, read migration guide.

It seems like you are using tronweb@6, please use const { TronWeb } = require('tronweb'). To know more, read migration guide.
Your answer solved my problem, thank you