【问题标题】:NestJS can't resolve dependecies of the LocalAuthGuardNestJS 无法解析本地 AuthGuard 的依赖关系
【发布时间】:2022-02-15 04:30:29
【问题描述】:

我正在关注有关身份验证主题的 NestJS 文档,但由于某种原因,该程序无法运行。我实际上是在复制和粘贴所有代码,并执行所有 CLI 命令,但它一直给我这个错误:

Error: Nest can't resolve dependencies of the LocalAuthGuard. Please make sure that the "optios available in the current context.

Potential solutions:
- If AuthModuleOptions is a provider, is it part of the current AppModule?
- If AuthModuleOptions is exported from a separate @Module, is that module imported within App
  @Module({
    imports: [ /* the Module containing AuthModuleOptions */ ]
  })

AuthModuleOptions 不在代码中的任何位置,那它可能是什么?老实说,我不知道。

【问题讨论】:

    标签: nestjs backend


    【解决方案1】:

    【讨论】:

    • 啊,很好,我还以为我到底做错了什么哈哈。我应该只降级 Nest 版本,还是有办法解决?我只是在学习,所以我不知道我能做什么。
    • 就像链接的问题所说的那样,您可以将 PassportModule.register({}) 添加到使用 AuthGuard() 的每个模块中,或者您可以降级到 8.1.0 并固定 dep
    猜你喜欢
    • 2019-12-19
    • 2018-11-22
    • 2019-12-19
    • 2018-12-25
    • 2018-12-27
    • 2020-01-14
    • 2021-06-09
    • 1970-01-01
    • 2019-09-12
    相关资源
    最近更新 更多