简体   繁体   中英

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. when I was using typescript it worked just fine, but when I build it with parcel to js I keep getting this error:

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...

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

For those who are using nestjs you may get this error if you do not place proper imports in your corresponding module(s):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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