Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

483
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda