环回未发现设计时类型元数据错误

Oli*_*RRY 0 typescript loopback4

使用 Loopback 4 执行控制器时出现以下 500 错误。

Unhandled error in GET /v1/me/societes: 500 Error: No design-time type metadata found while inspecting FirebaseAuthService.constructor[2]. You can either use `@service(ServiceClass)` or ensure `emitDecoratorMetadata` is enabled in your TypeScript configuration. Run `tsc --showConfig` to print the final TypeScript configuration of your project.
Run Code Online (Sandbox Code Playgroud)

我认为问题是因为FirebaseService这里的注入:

@injectable({scope: BindingScope.SINGLETON})
export class FirebaseAuthService {
  constructor(
    @repository(UtilisateurRepository)
    public utilisateurRepository: UtilisateurRepository,
    @repository(TokenRepository)
    public tokenRepository: TokenRepository,
    @service(FirebaseService)
    public firebaseService: FirebaseService,
  ) {}
Run Code Online (Sandbox Code Playgroud)

但是这个FirebaseService类看起来不错:

@injectable({scope: BindingScope.SINGLETON})
export class FirebaseService {
Run Code Online (Sandbox Code Playgroud)

我所有的服务类都在src/services目录中,因此它们应该由 Loopback 注册。或者也许我的问题与服务注入无关?

我试图理解这一点数小时。有人有想法吗?

谢谢你的帮助 !

奥利维尔

小智 6

我也有同样的问题。您需要导入此文件的完整路径而不是文件夹。例如:从'./services/service-a.service'导入ServiceA;