Billionz
Billionz11mo ago

NPM CCXT Not Working

I'm trying to run the NPM Package CCXT and I'm getting an "ERR_MODULE_NOT_FOUND" error any help in resolving would be much appreciated. TypeError: Could not resolve 'debug' from 'file:///Users/xxx/Library/Caches/deno/npm/registry.npmjs.org/ccxt/4.1.75/js/src/static_dependencies/proxies/http-proxy-agent/index.js'.
import ccxt, { Exchange, Order } from 'npm:ccxt'
export const ccxtpro = ccxt.pro

const bybit = new ccxtpro.bybit({
enableRateLimit: false,
options: { defaultType: 'swap' },
})

for (let index = 0; index < 5; index++) {
try {
console.log('fetch data ')
console.time('Fetch Ticker ' + index)
const ticker = await bybit.fetchTicker('BTC/USDT:USDT')
console.timeEnd('Fetch Ticker ' + index)
logger.info(index + ' ' + ticker.last)
} catch (error) {
console.log(error)
}
}
import ccxt, { Exchange, Order } from 'npm:ccxt'
export const ccxtpro = ccxt.pro

const bybit = new ccxtpro.bybit({
enableRateLimit: false,
options: { defaultType: 'swap' },
})

for (let index = 0; index < 5; index++) {
try {
console.log('fetch data ')
console.time('Fetch Ticker ' + index)
const ticker = await bybit.fetchTicker('BTC/USDT:USDT')
console.timeEnd('Fetch Ticker ' + index)
logger.info(index + ' ' + ticker.last)
} catch (error) {
console.log(error)
}
}
8 Replies
marvinh.
marvinh.11mo ago
Looking into the npm package it seems like they depend on the debug package but haven't listed that as a dependency inside their package.json This likely only works by accident even in node because another dependency might put debug into node_modules which this one relies on Would be worth filing a bug report in their tracker that they forgot to list the dependency in their package.json
Billionz
Billionz11mo ago
thank you is there a way I can load it manaully as a hot fix in the interim
marvinh.
marvinh.11mo ago
I don't think so. deno expects the contents in package.json to be correct
Billionz
Billionz11mo ago
Ok , thanks again
marvinh.
marvinh.11mo ago
maybe through esm.sh?
Billionz
Billionz11mo ago
Would you be able to show me how to try that, still very new to deno
marvinh.
marvinh.11mo ago
Changing npm:ccxt to https://esm.sh/cctx should be enough to give that a go
Billionz
Billionz11mo ago
Thank you, that worked great!!