小编goo*_*est的帖子

Nest 无法解析 MailerService 的依赖关系(?)

我正在尝试配置这个模块

完整的错误消息如下:

Nest can't resolve dependencies of the MailerService (?). Please make sure that the argument MAILER_OPTIONS at index [0] is available in the AppModule context.

我总是莫名其妙地收到此错误,什么 MAILER_OPTIONS?这些选项在哪里?文档中没有提及这方面的内容。完全不知道发生了什么。

这是我的应用程序模块:

@Module({
  imports: [
    MailerModule.forRoot({
      defaults: {
        from: '"No Reply" <noreply@example.com>',
      },
      template: {
        dir: path.join(process.env.PWD, 'templates/pages'),
        adapter: new HandlebarsAdapter(),
        options: {
          strict: true,
        },
      },
      options: {
        partials: {
          dir: path.join(process.env.PWD, 'templates/partials'),
          options: {
            strict: true,
          },
        },
      },
    }),
  ],
  controllers: [AppController],
  providers: [
    AppService,
    MailerService,
  ],
}) …
Run Code Online (Sandbox Code Playgroud)

javascript dependency-injection node.js typescript nestjs

1
推荐指数
1
解决办法
3013
查看次数