//에러
[Nest] 6655 - 2022. 02. 02. 오후 1:49:12 ERROR [ExceptionHandler] No metadata for "Board" was found.
EntityMetadataNotFoundError: No metadata for "Board" was found.
at EntityMetadataNotFoundError.TypeORMError [as constructor] (/Users/xxx/Desktop/prj3/src/error/TypeORMError.ts:7:9)
at new EntityMetadataNotFoundError (/Users/xxx/Desktop/prj3/src/error/EntityMetadataNotFoundError.ts:7:9)
at Connection.getMetadata (/Users/xxx/Desktop/prj3/src/connection/Connection.ts:330:19)
at EntityManager.getCustomRepository (/Users/xxx/Desktop/prj3/src/entity-manager/EntityManager.ts:1038:86)
at Connection.getCustomRepository (/Users/xxx/Desktop/prj3/src/connection/Connection.ts:365:29)
at InstanceWrapper.useFactory [as metatype] (/Users/xxx/Desktop/prj3/node_modules/@nestjs/typeorm/dist/typeorm.providers.js:13:35)
at Injector.instantiateClass (/Users/xxx/Desktop/prj3/node_modules/@nestjs/core/injector/injector.js:304:55)
at callback (/Users/xxx/Desktop/prj3/node_modules/@nestjs/core/injector/injector.js:48:41)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Injector.resolveConstructorParams (/Users/xxx/Desktop/prj3/node_modules/@nestjs/core/injector/injector.js:124:24)
//해결
//TypeOrm 관련모듈 오류
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { Board } from '../board-entity';
import { BoardsModule } from '../boards.module';
export const typeORMConfig: TypeOrmModuleOptions = {
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'board-app',
entities: [__dirname + '/../**/*.entity.{js,ts}'],
synchronize: true,
};
//TypeOrm 관련모듈 해결
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
import { Board } from '../board-entity';
import { BoardsModule } from '../boards.module';
export const typeORMConfig: TypeOrmModuleOptions = {
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'board-app',
entities: [__dirname + '/../**/*.entity.{js,ts}',Boards],
synchronize: true,
};
**해당 에러는 모듈의 이름이 에러났거나 혹은 TypeOrmConfig entities에 해당 모듈을 포함시켜주면 해결된다
참고자료 하단에