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

438
Vistas
NodeJS Express server: SyntaxError: Invalid or unexpected token

I have installed typescript in my project and it works fine on the frontend. on the backend I have a node express server. I've started implementing TS there. when I ran the server just now it failed with:

filename: (req: Request, file, cb) => {

SyntaxError: Invalid or unexpected token (pointing at the :)

How can I make TS work on the server?

I've installed esm which allows me to use imports, I've also included: "module": "commonjs" in the package.json

how do I fix this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You have to compile the TypeScript into JavaScript (e.g. with tsc) and then run the resulting JavaScript with Node.js (which doesn't have native support for TypeScript).

Alternatively, look at ts-node.

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