繁体   English   中英

TYPEORM RepositoryNotFoundError:找不到“i”的存储库。 看起来这个实体没有在当前的“默认”连接中注册?

[英]TYPEORM RepositoryNotFoundError: No repository for "i" was found. Looks like this entity is not registered in current "default" connection?

我正在尝试使用 orm 类型在数据库中设置用户。 当我使用 typescript 时它工作得很好,但是当我用 parcel to js 构建它时,我不断收到这个错误:

RepositoryNotFoundError: No repository for "i" was found. Looks like this entity is not registered in current "default" connection?
    at new RepositoryNotFoundError (D:\GitHub\discord-bot-test\node_modules\typeorm\error\RepositoryNotFoundError.js:11:28)
    at EntityManager.getRepository (D:\GitHub\discord-bot-test\node_modules\typeorm\entity-manager\EntityManager.js:649:19)
    at Connection.getRepository (D:\GitHub\discord-bot-test\node_modules\typeorm\connection\Connection.js:367:29)
    at Object.getRepository (D:\GitHub\discord-bot-test\node_modules\typeorm\index.js:269:55)
    at D:\GitHub\discord-bot-test\bot.js:20:5065
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

而且我不知道为什么它不起作用,因为 typescript 确实起作用...

我不能把代码放在这里,因为它有很多字符......

有人可以单独帮助我解决这个问题吗?

尝试将@Entity('i')放在export class I {}上方的实体文件夹中我无法发布图像,但是像这样 -> https://i.stack.imgur.com/BHuEF.png

对于那些使用nestjs的人,如果您没有在相应的模块中放置正确的导入,您可能会收到此错误:

@Module({
  imports:     [TypeOrmModule.forFeature([AaaEntity, BbbEntity, ...]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM