tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
423 stars 271 forks source link

@noble/secp256k1 package removed from package.json but still required in node build #432

Closed george-of-croton closed 11 months ago

george-of-croton commented 11 months ago

node build still seems to use the @noble/secp256k1 package. I built it locally and it seems to have @noble/curves/secp256k1.

build on npm registry: image latest build locally:

image

is it possible that build has not been pushed to NPM?

start940315 commented 11 months ago

The master code of git is v5.3.1. And it hasn't been published to npm. So the build result is different.

george-of-croton commented 11 months ago

it seems like the current node build on NPM is broken then?

node:internal/modules/cjs/loader:1024
  throw err;
  ^

Error: Cannot find module '@noble/secp256k1'
Require stack:
- /workspace/backend/backend/node_modules/tronweb/dist/TronWeb.node.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1021:15)
    at Function.Module._load (node:internal/modules/cjs/loader:866:27)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at /workspace/backend/backend/node_modules/tronweb/dist/TronWeb.node.js:1:296510
    at /workspace/backend/backend/node_modules/tronweb/dist/TronWeb.node.js:1:694217
    at Object.<anonymous> (/workspace/backend/backend/node_modules/tronweb/dist/TronWeb.node.js:1:694246)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/workspace/backend/backend/node_modules/tronweb/dist/TronWeb.node.js'
  ]
}

steps to reproduce: write a file that require tronweb. run node <path to your script>

example:

const tronweb = require("tronweb");

console.log(tronweb)
tungulin commented 11 months ago

You can use "tronweb": "5.2.0" - without caret . Its working for me

start940315 commented 11 months ago

You can now using npm i @noble/secp256k1@1.7.1 to solve this problem. Soon, we'll publish tronweb@5.3.1.