Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'bn.js' in '/home/cot-zzq/my-first-dapp/client/node_modules/@pythnetwork/price-service-sdk/lib' #1396

Open
zzqVip opened this issue Mar 27, 2024 · 1 comment

Comments

@zzqVip
Copy link

zzqVip commented Mar 27, 2024

import { AptosPriceServiceConnection } from '@pythnetwork/pyth-aptos-js'
"@pythnetwork/pyth-aptos-js": "^1.4.2",
"@pythnetwork/pyth-common-js": "^1.4.0",
Error:
Module not found: Error: Can't resolve 'bn.js' in '/home/cot-zzq/my-first-dapp/client/node_modules/@pythnetwork/price-service-sdk/lib'

@rout-horizon
Copy link

Code works fine with ethers@5 but fails with ethers@6
Maybe it has to do with BigNumber being replaced with BigInt in ethers-v6
const { EvmPriceServiceConnection } = require("@pythnetwork/pyth-evm-js"); // version - ^1.44.0

`node:internal/modules/cjs/loader:1051
throw err;
^

Error: Cannot find module 'bn.js'
Require stack:

  • /home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-sdk/lib/AccumulatorUpdateData.js
  • /home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-sdk/lib/index.js
  • /home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-client/lib/PriceServiceConnection.js
  • /home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-client/lib/index.js
  • /home/ubuntu/sample-project/node_modules/@pythnetwork/pyth-evm-js/lib/EvmPriceServiceConnection.js
  • /home/ubuntu/sample-project/node_modules/@pythnetwork/pyth-evm-js/lib/index.js
  • /home/ubuntu/sample-project/utils.js
  • /home/ubuntu/sample-project/orderListener.js
  • /home/ubuntu/sample-project/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object. (/home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-sdk/lib/AccumulatorUpdateData.js:7:33)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-sdk/lib/AccumulatorUpdateData.js',
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-sdk/lib/index.js',
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-client/lib/PriceServiceConnection.js',
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/price-service-client/lib/index.js',
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/pyth-evm-js/lib/EvmPriceServiceConnection.js',
    '/home/ubuntu/sample-project/node_modules/@pythnetwork/pyth-evm-js/lib/index.js',
    '/home/ubuntu/sample-project/utils.js',
    '/home/ubuntu/sample-project/orderListener.js',
    '/home/ubuntu/sample-project/index.js'
    ]
    }

Node.js v20.9.0`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants