Nestjs TypeORM 依赖问题

Nestjs TypeORM dependency issue

我对 Nestjs 比较陌生,我目前在我的产品中使用它,但我不断收到以下错误:

错误:Nest 无法导出不属于当前处理的模块 (TypeOrmCoreModule) 的 provider/module。请验证导出的连接在此特定上下文中是否可用。

Possible Solutions:
- Is Connection part of the relevant providers/imports within TypeOrmCoreModule?

    at Module.validateExportedProvider (/node_modules/@nestjs/core/injector/module.js:283:19)
    at addExportedUnit (/node_modules/@nestjs/core/injector/module.js:251:67)
    at Module.addExportedProvider (/node_modules/@nestjs/core/injector/module.js:262:9)
    at NestContainer.addExportedProvider (/node_modules/@nestjs/core/injector/container.js:127:19)
    at DependenciesScanner.insertExportedProvider (/node_modules/@nestjs/core/scanner.js:231:24)
    at /node_modules/@nestjs/core/scanner.js:134:50
    at Array.forEach (<anonymous>)
    at DependenciesScanner.reflectExports (/node_modules/@nestjs/core/scanner.js:134:17)
    at DependenciesScanner.scanModulesForDependencies (/node_modules/@nestjs/core/scanner.js:87:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async DependenciesScanner.scan (/node_modules/@nestjs/core/scanner.js:29:9)
    at async /node_modules/@nestjs/core/nest-factory.js:95:17
    at async Function.asyncRun (/node_modules/@nestjs/core/errors/exceptions-zone.js:22:13)
    at async NestFactoryStatic.initialize (/node_modules/@nestjs/core/nest-factory.js:94:13)
    at async NestFactoryStatic.create (/node_modules/@nestjs/core/nest-factory.js:37:9)
    at async bootstrap (/dist/main.js:11:17)

我不知道这个错误是从哪里产生的,它似乎是一个 TypeOrm 错误,但我不确定。

请指出原因或解决方法,我们将不胜感激。

嵌套版本:“^8.0.0”

提前致谢。

如果您不想使用最新版本的 typeorm,您应该将 @nestjs/typeorm 降级到 8.0.4,如此处讨论:https://github.com/nestjs/typeorm/issues/1289 因为 @nestjs/typeorm 8.1 仅兼容 typeorm@0.3