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

309
Views
Mikro-orm: Only abstract entities were discovered

I'm working in a node.js (+Express) backend and I'm trying to use Mikro-orm without using Typescript.

I followed this project as reference + Mikro-orm documentation but I keep getting this error:

MetadataError: Only abstract entities were discovered, maybe you forgot to use @Entity() decorator?

Is there a way to avoid using Typescript's decorators? Or maybe a better question would be is it possible to use Mikro-orm in a pure JS project?

The configuration file mikro-orm.config.js looks like:

module.exports = {
  entities: [EntityX, EntitiyZ],
  type: 'mysql',
  dbName: 'example',
  highlighter: new SqlHighlighter(),
  debug: true
};

The versions I have installed are:

"@mikro-orm/core": "^4.5.10",
"@mikro-orm/mysql": "^4.5.10"

Any help will be much appreciated, thanks!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I was running into this exact problem when I discovered this question (thanks for posting).

I was able to resolve the issue by ensuring the default export from each of my entity files has the shape that Mikro-ORM seems to be expecting, which in your case would look something like:

export default {
    EntityX,
    schema,
    entity: EntityX
}

**EDIT

On second look I realize that you're using CommonJS syntax, so without seeing your entity files I'd assume you could be missing something like:

module.exports.EntityX = EntityX;
module.exports.entity = EntityX;
module.exports.schema = schema;

in your entity file, or you forgot to wire up the entities/index.js as shown in the example you linked.

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!