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

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

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