javascript - TYPEORM RepositoryNotFoundError:找不到“i”的存储库。看起来这个实体没有在当前的“默认”连接中注册?
问题描述
我正在尝试使用 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)
而且我不知道为什么它不起作用,因为打字稿确实有效......
我不能把代码放在这里,因为它有很多字符......
有人可以单独帮助我解决这个问题吗?
解决方案
对于那些使用nestjs的人,如果您没有在相应的模块中放置正确的导入,您可能会收到此错误:
@Module({
imports: [TypeOrmModule.forFeature([AaaEntity, BbbEntity, ...]
推荐阅读
- android - 原始错误:执行 adbExec 时出错。通过appium在手机上启动应用程序时出错
- scala - 无论顺序如何,您如何检查是否使用 Seq 调用了模拟
- neo4j - 由于缺乏具体化,与 RDF 图相比,属性图的表达能力很小?
- mysql - 分组下单
- c# - 如何从提供的 JSON 中获取值?
- javascript - 如何创建每行 3 个项目的水平网格
- android - 如何指示 Gradle 从不同位置使用 Java?
- qt - 需要帮助在 QT 中将 QString 值从一个屏幕传递到另一个屏幕
- javascript - 如何在执行构建之前修改 Node.js 中所需的模块?
- java - Android Glide BlurTransformation