Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

481
Views
Node.js basic error: Uncaught TypeError: Binance is not a function

newbie here! I'm trying to make a basic ping to the Binance crypto exchange using its exposed REST API and node.js. Instead of coding everything from 0, I'm planning to use a wrapper package in https://github.com/binance-exchange/binance-api-node that facilities interaction. I've downloaded the binance-api-node code from github into my node.js project.

After installing the package, when trying to run the included basic getting-started code to get the time from the server:

import Binance from 'binance-api-node';

const client = Binance();

client.time().then(time => console.log(time));

I’m getting this error:

Uncaught TypeError: Binance is not a function

I also tried:

const client = new Binance();

but I get another error saying Binance is not a constructor.

This is the function declaration in the index.d.ts of binance-api-node

    declare module 'binance-api-node' {
      export default function(options?: {
        apiKey?: string
        apiSecret?: string
        getTime?: () => number | Promise<number>
        httpBase?: string
        httpFutures?: string
        wsBase?: string
        wsFutures?: string
        proxy?: string
      }): Binance

...

Any help will be appreciated.

Thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As stated in documentation:

If you do not have an appropriate babel config, you will need to use the basic commonjs requires:

const Binance = require('binance-api-node').default
const client = Binance();

Or like this, it worked for me:

import Binance from 'binance-api-node';
const client = Binance.default();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!