79445948

Date: 2025-02-17 16:04:42
Score: 1
Natty:
Report link

I can't comment, so I'm answering. I had the same problem.

I simplified the project to one basic entity. I tried both the TsMorphMetadataProvider and the ReflectMetadataProvider.

My tsconfig has:

  "compilerOptions": {
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "target": "ES2022",
  },

The error comes from: node_modules@nestjs\core\injector\injector.js:72

It only occurs when I define:

entities: ['./dist/**/*.entity.js'],
entitiesTs: ['./src/**/*.entity.ts'],

If I use the following, it will be fine:

entities: [TestEntity],

I'm not sure what is happening in NestJs at that moment though. I narrowed it down to MikroOrm because the exception is for moduleRef.name == 'MikroOrmCoreModule'

The debug log of MikroOrm states: processing 1 files, so it definitly finds the entity file.

I can't use the autoLoadEntities in my case. So I'll add the entities manually, but if someone can narrow down what's happening and how to solve it, that would be welcome.

Reasons:
  • Blacklisted phrase (1): how to solve
  • Whitelisted phrase (-1): I had the same
  • RegEx Blacklisted phrase (1): can't comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Tyrghen