TypeError: require(...).options is not a function
zevsuld opened this issue · comments
Short Description:
- Tried latest api version 0.8. Got error: TypeError: require(...).options is not a function
Platform:
- macos
node version:
- v9.11.1
Long descrption
- Previous version of api is works fine. However when I tried latest version 0.8 got TypeError.
Updated npm, still same error. When I looked into node_modules folder there are many modules, previous version of api has only 2 modules. I am guessing newer version works this way.
How can I fix this error, please help.
code
const binance = require('node-binance-api').options({
APIKEY: '',
APISECRET: '',
useServerTime: true, // If you get timestamp errors, synchronize to server time at startup
test: true // If you want to use sandbox mode where orders are simulated
});
binance.prices((error, ticker) => {
console.log("prices()", ticker);
console.log("Price of BTC: ", ticker.BTCUSDT);
});
result
(function (exports, require, module, __filename, __dirname) { const binance = require('node-binance-api').options({
^
TypeError: require(...).options is not a function
Hmm strange, could you try it this way as well please?
const Binance = require('node-binance-api');
const binance = new Binance().options({
APIKEY: '',
APISECRET: '',
useServerTime: true
});
@jaggedsoft It worked. thank you!!!