[英]TYPEORM RepositoryNotFoundError: No repository for "i" was found. Looks like this entity is not registered in current "default" connection?
I'm trying to use type orm to set users in the database.我正在尝试使用 orm 类型在数据库中设置用户。 when I was using typescript it worked just fine, but when I build it with parcel to js I keep getting this error:当我使用 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)
and I dont know why it doesn't work because the typescript does work...而且我不知道为什么它不起作用,因为 typescript 确实起作用...
I cant put the code here because its got to many characters...我不能把代码放在这里,因为它有很多字符......
can someone help me with this alone as context?有人可以单独帮助我解决这个问题吗?
Try putting @Entity('i')
above your export class I {}
inside the entity folder I can't post an image, but like this -> https://i.stack.imgur.com/BHuEF.png尝试将@Entity('i')
放在export class I {}
上方的实体文件夹中我无法发布图像,但是像这样 -> https://i.stack.imgur.com/BHuEF.png
For those who are using nestjs you may get this error if you do not place proper imports in your corresponding module(s):对于那些使用nestjs的人,如果您没有在相应的模块中放置正确的导入,您可能会收到此错误:
@Module({
imports: [TypeOrmModule.forFeature([AaaEntity, BbbEntity, ...]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.