简体   繁体   English

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

[英]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.

相关问题 在 typeorm 中获取 RepositoryNotFoundError 但我很确定它们已注册 - Getting RepositoryNotFoundError in typeorm but I'm pretty sure they are registered RepositoryNotFoundError:当我使用导入时,没有找到 [Enitity] 的存储库 - RepositoryNotFoundError: No repository for [Enitity] was found when I using imports RepositoryNotFoundError : TypeORM - RepositoryNotFoundError : TypeORM 在类中使用TypeORM找不到连接默认值 - Connection default not found using TypeORM in a class 在 jest globalSetup 中创建连接时,找不到 Typeorm 连接“默认” - Typeorm Connection “default” was not found when connection is created in jest globalSetup 如何扩展 javascript object 看起来像:`export default { ... }` - How do I extend a javascript object that looks like: `export default { … }` 在 TypeScript 中找不到存储库错误,当我通过 typeorm 连接到 MySQL 时遇到错误 - Repository Not Found Error in TypeScript, when I was connecting to MySQL through the typeorm it was encountering the error 错误 [ExceptionHandler] 未找到“产品”的存储库。 Nest.js - ERROR [ExceptionHandler] No repository for "Product" was found. Nest.js 我可以在另一个实体中插入一个值吗? 类型ORM - Can I insert a value into another entity? TypeORM ConnectionNotFoundError:未找到连接“默认” - ConnectionNotFoundError: Connection “default” was not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM