i have successfully installed nodejs v21.7.3
also installed "@noble/secp256k1": "^2.1.0",
then installed "tronweb": "^5.3.2"
my index.js file looks like this
`import TronWeb from 'tronweb';
import express from 'express';
console.log('janu');`
and my package.json look like this
{ "name": "nodeprojects", "version": "1.0.0", "description": "my tronweb project", "type": "module", "main": "index.js", "scripts": { "test": "node index" }, "keywords": [ "masum", "sumaya" ], "author": "masum", "license": "ISC", "dependencies": { "@noble/secp256k1": "^2.1.0", "express": "^4.19.2", "tronweb": "^5.3.2" } }
when i run node index then i am getting error
`node:internal/process/esm_loader:34
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\nodeprojects\node_modules\@noble\secp256k1\index.js from D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js not supported.
Instead change the require of index.js in D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js to a dynamic import() which is available in all CommonJS modules.
at D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:296544
at D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:697113
at Object. (D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:697142) {
code: 'ERR_REQUIRE_ESM'
}`
i have successfully installed nodejs v21.7.3 also installed "@noble/secp256k1": "^2.1.0", then installed "tronweb": "^5.3.2" my index.js file looks like this `import TronWeb from 'tronweb'; import express from 'express';
console.log('janu');`
and my package.json look like this
{ "name": "nodeprojects", "version": "1.0.0", "description": "my tronweb project", "type": "module", "main": "index.js", "scripts": { "test": "node index" }, "keywords": [ "masum", "sumaya" ], "author": "masum", "license": "ISC", "dependencies": { "@noble/secp256k1": "^2.1.0", "express": "^4.19.2", "tronweb": "^5.3.2" } }
when i run node index then i am getting error `node:internal/process/esm_loader:34 internalBinding('errors').triggerUncaughtException( ^Error [ERR_REQUIRE_ESM]: require() of ES Module D:\nodeprojects\node_modules\@noble\secp256k1\index.js from D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js not supported. Instead change the require of index.js in D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js to a dynamic import() which is available in all CommonJS modules. at D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:296544 at D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:697113 at Object. (D:\nodeprojects\node_modules\tronweb\dist\TronWeb.node.js:1:697142) {
code: 'ERR_REQUIRE_ESM'
}`