【发布时间】:2020-01-05 02:19:50
【问题描述】:
我在使用 NestJS 的应用程序的开发模式下遇到此错误。
我的配置文件如下:
export const ORM_CONFIG: TypeOrmModuleOptions = {
keepConnectionAlive: true,
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'aimbra_education',
schema: 'security',
synchronize: true,
entities: [
--Entities
],
// migrations: [__dirname + '/migration/**/*.ts'],
// subscribers: [__dirname + '/subscriber/**/*.ts'],
};
我导入到:
@Module({
imports: [
TypeOrmModule.forRoot(ORM_CONFIG),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
到目前为止,我无法确定为什么它在生产中工作并且在开发模式下无法查看我的修改的错误。
【问题讨论】:
-
检查路径导入是否有前缀
"src/..."是否有替换它以手动定位"../../..." -
import { Entity, PrimaryGeneratedColumn, Column } from '../../../node_modules/typeorm';我试着加了,还是不行…… -
不适用于
node_modules,请尝试使用您的服务、控制器、模块、实体文件 -
能否提供您的
tsconfig.json文件内容? -
请勿发布代码、数据、错误消息等的图片 - 将文本复制或输入到问题中。 stackoverflow.com/help/how-to-ask
标签: typescript nestjs typeorm