nestjs-redis icon indicating copy to clipboard operation
nestjs-redis copied to clipboard

Nest can't resolve dependencies of the RedisCoreModule (Symbol(REDIS_MODULE_OPTIONS), ?). Please make sure that the argument ModuleRef at index [1] is available in the RedisCoreModule context.

Open SnowingFox opened this issue 3 years ago • 23 comments

// config.ts
export const redisConfig: RedisModuleOptions = {
  url: 'redis://treehole:redis@localhost:6379/1',
}
import databaseConfig, { redisConfig } from './config/database.config'

@Module({
  imports: [TypeOrmModule.forRoot(databaseConfig), UserModule, AuthModule, RedisModule.register(redisConfig)],
  controllers: [],
  providers: [],
})
export class AppModule {}

But it gave me an error

[Nest] 35656  - 2022/02/14 下午3:50:35   ERROR [ExceptionHandler] Nest can't resolve dependencies of the RedisCoreModule (Symbol(REDIS_MODULE_OPTIONS), ?). Please make sure that the argument ModuleRef at index [1] is available in the RedisCoreModule co
ntext.

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

Error: Nest can't resolve dependencies of the RedisCoreModule (Symbol(REDIS_MODULE_OPTIONS), ?). Please make sure that the argument ModuleRef at index [1] is available in the RedisCoreModule context.

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

    at Injector.lookupComponentInParentModules (C:\Dev\hfut-tree-hole\nest\node_modules\@nestjs\core\injector\injector.js:202:19)
    at Injector.resolveComponentInstance (C:\Dev\hfut-tree-hole\nest\node_modules\@nestjs\core\injector\injector.js:157:33)

What happen? And what should i do to solve it? I'm sure that the redis server is no wrong.

SnowingFox avatar Feb 14 '22 07:02 SnowingFox

same issue here

diegodelico avatar Feb 14 '22 19:02 diegodelico

same here, seems to be issue with nest 8

JustDoItSascha avatar Feb 16 '22 14:02 JustDoItSascha

same issue here

xiongsongsong avatar Feb 20 '22 13:02 xiongsongsong

same issue here

不是很明白,老哥能说清除一些么

SnowingFox avatar Feb 20 '22 14:02 SnowingFox

same here

kkachniarz220 avatar Feb 28 '22 12:02 kkachniarz220

same issue

scientiststwin avatar Mar 07 '22 12:03 scientiststwin

same

randygil avatar Mar 08 '22 21:03 randygil

https://github.com/skunight/nestjs-redis/issues/82

simplenotezy avatar Mar 10 '22 00:03 simplenotezy

same issue

kindtiger95 avatar Mar 23 '22 08:03 kindtiger95

Same here

vincentwinkel avatar Apr 07 '22 17:04 vincentwinkel

Same here

ZhangLinkang avatar Apr 09 '22 10:04 ZhangLinkang

same here

jcurbelo avatar Apr 11 '22 19:04 jcurbelo

Same here

juanjodev02 avatar Apr 12 '22 18:04 juanjodev02

Fixed by using @liaoliaots/nestjs-redis instead.

vincentwinkel avatar Apr 19 '22 09:04 vincentwinkel

same issue

dobrovolskaa avatar Apr 19 '22 16:04 dobrovolskaa

一样的问题

ColtonVan avatar Apr 24 '22 10:04 ColtonVan

这个包是不维护了吗?

ColtonVan avatar Apr 24 '22 10:04 ColtonVan

Is this resolved yet?

KieronWiltshire avatar Jun 01 '22 22:06 KieronWiltshire

Is this resolved yet?

i resolved by change package.json to "nestjs-redis": "github:skunight/nestjs-redis",

chary1n avatar Jun 15 '22 07:06 chary1n

same issue

laiyazhou avatar Aug 12 '22 03:08 laiyazhou

same issue

vantrung1408 avatar Oct 13 '22 04:10 vantrung1408

For anyone having this issue, I resolved this by switching over to https://www.npmjs.com/package/@liaoliaots/nestjs-redis.

KieronWiltshire avatar Oct 26 '22 15:10 KieronWiltshire

issue is caused by @nestjs/core and other nestjs libraries in nestjs-redis package.json dependencies. It should be moved to peer dependencies.

I guess Nest.js is trying to inject ModuleRef from nestjs-redis/@nestjs/core instead of @nestjs/core installed in your app.

michaldziuba03 avatar Jan 14 '23 09:01 michaldziuba03

Same issue! now use https://www.npmjs.com/package/@liaoliaots/nestjs-redis it works

ZhaoKunLong avatar Aug 07 '23 09:08 ZhaoKunLong