EntityMetadataNotFoundError: No metadata for " * " was found.
이슈가 발생했다. 찾아보니 typeorm.config.ts에서 entity 경로가 잘못되어있는 경우 발생하는 오류라고 한다.
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
export const ORMConfig: TypeOrmModuleOptions = {
type: 'postgres',
url: 'url',
entities: [__dirname + '../**/*.entity.{js,ts}'],
synchronize: true,
};
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
export const ORMConfig: TypeOrmModuleOptions = {
type: 'postgres',
url: 'url',
entities: [__dirname + '/../**/*.entity.{js,ts}'],
synchronize: true,
};
정말 오타로 에러가 많이 나는거 같다. __dirname 이 어떤 경로를 가르키고 있는지도 다시 한번 확인해봐야겠다.
node.js 에서 dirname을 확인해보았다.
//index.js
console.log('dirname', __dirname);
//node index.js
//나의 경로를 공개하기는 힘들고, 현재 프로젝트 디렉토리를 가르키고 있었다. 한번해보시길 추천!
//중요! 마지막에 슬래쉬가 없는 것을 확인 할 수 있었다.!
그냥 따라 치지말고 항상 한번 더 확인하고 넘어가는 습관을 들이자!