Troubleshooting
“No entities were discovered”
Section titled ““No entities were discovered””Your MikroORM config found zero entities. This usually means the entity path doesn’t match how the CLI is loading your config:
- If you’re using a
.tsconfig (the CLI loadstsxautomatically and defaults topreferTs: true), make sureentitiesTspoints to your TypeScript source files. - If you’re using a compiled
.jsconfig, make sureentitiespoints to the built output (e.g../dist/**/*.entity.js) and that you’ve run your build first. - MikroORM uses
entitiesTswhen running in TypeScript mode andentitiesotherwise — if you use folder/file-based discovery, specify both.
“Please provide either ‘type’ or ‘entity’ attribute”
Section titled ““Please provide either ‘type’ or ‘entity’ attribute””MikroORM could not resolve a property type during metadata discovery. The CLI loads .ts configs through tsx, so enabling emitDecoratorMetadata alone will not fix this path.
Fix it in one of these ways:
- Add explicit decorator options, such as
@Property({ type: 'string' })or@ManyToOne({ entity: () => User }). - Install
@mikro-orm/reflectionat the same exact version as@mikro-orm/coreso the CLI can auto-useTsMorphMetadataProvider.
“Cannot find module ‘@/…’” (path aliases)
Section titled ““Cannot find module ‘@/…’” (path aliases)”If your config or entities use tsconfig path aliases (e.g. @/entities/user), tsx may fail to resolve them when it cannot find the right tsconfig.json. Keeping the config file at your project root (next to tsconfig.json) avoids this. If your config lives elsewhere, pass the right file explicitly:
mikro-orm-markdown --config ./packages/api/mikro-orm.config.ts --tsconfig ./packages/api/tsconfig.jsonJSDoc tags are missing, or @hidden entities appear
Section titled “JSDoc tags are missing, or @hidden entities appear”Your entities were probably discovered from compiled JavaScript. Build tools may strip comments from .js files, so descriptions, @namespace, and @hidden cannot be read there.
Prefer a .ts config with entitiesTs pointing at your source files. If you must run from compiled .js, pass the original TypeScript sources:
mikro-orm-markdown --config ./dist/mikro-orm.config.js --src "src/**/*.entity.ts"See Compiled JavaScript builds.
Config file requirements
Section titled “Config file requirements”The config file must have a default export of a plain configuration object — see CLI Options. If you need to resolve the config asynchronously, use the programmatic API.