小编mpa*_*lma的帖子

注入 CACHE_MANAGER 的 NestJs 测试

我有一些服务,我在构造函数中注入 CACHE_MANAGER

import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
import { Cache } from 'cache-manager';
...
export class ManagerService {
   constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache) {}
   ...
}
Run Code Online (Sandbox Code Playgroud)

当我测试导入这些服务的模块时,这给了我一个错误

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

我对 NestJs 比较陌生,所以我真的不知道如何解决它

javascript node.js nestjs

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

javascript ×1

nestjs ×1

node.js ×1