TypeORM cannot find entities if entity directory was not set in configuration files
The most common case you described is to have separate entities
directory which consists only of Entity declarations.
{..."entities": ["src/bar/entities/**/*.ts"]}
Another approach would be importing each entity separately:
import {User} from "./payment/entity/User";import {Post} from "./blog/entity/Post";{..."entities": [User, Post]}
For me it helped to include also src
directory to ormconfig.json
:
"entities": [ "dist/**/*.entity{.ts,.js}", "src/**/*.entity{.ts,.js}" ],
For me the answer was { ... entities: [join(__dirname, '/../**/**.entity{.ts,.js}')],}
I've found the exapmle herehttps://github.com/nestjs/nest/blob/master/sample/05-sql-typeorm/src/app.module.ts