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

436
Views
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 answers
Answer question

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 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!