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

304
Views
TypeORM @Entity SyntaxError: Invalid or unexpected token

I'm trying to use TypeORM in Javascript node app but when I created my first Entity and tried to run the app I got Invalid or unexpected token

@Entity({ name: "application_users" })
SyntaxError: Invalid or unexpected token
at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:115:18)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:289:14)  

Entity:

import { Entity, Column, PrimaryColumn } from "typeorm";

@Entity({ name: "application_users" })
export class User {
  @PrimaryColumn()
  id: String;

  @Column()
  biography: String;

  @Column()
  country: String;

  @Column()
  email: String;

  @Column()
  image: String;
}

Data Source:

export const AppDataSource = new DataSource({
  type: "postgres",
  url: process.env.DATABASE_URL,
  logging: true,
  synchronize: true,
  entities: [User],
});

AppDataSource.initialize()
  .then(() => console.log("Connected to DB"))
  .catch((err) => console.error("Failed connecting to DB", err));
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

This is probably due using TypeScript syntax in JavaScript files.

about 4 years ago · Santiago Gelvez 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!