Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

440
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda