Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #97

Open
SnowingFox opened this issue Feb 14, 2022 · 23 comments

Comments

@SnowingFox
Copy link

SnowingFox commented Feb 14, 2022

// 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.

@diegodelico
Copy link

same issue here

@JustDoItSascha
Copy link

same here, seems to be issue with nest 8

@xiongsongsong
Copy link

same issue here

@kkachniarz220
Copy link

same here

@scientiststwin
Copy link

same issue

@randygil
Copy link

randygil commented Mar 8, 2022

same

@simplenotezy
Copy link

#82

@kindtiger95
Copy link

same issue

@vincentwinkel
Copy link

Same here

1 similar comment
@ZhangLinkang
Copy link

Same here

@jcurbelo
Copy link

same here

@juanjodev02
Copy link

Same here

@vincentwinkel
Copy link

Fixed by using @liaoliaots/nestjs-redis instead.

@dobrovolskaa
Copy link

same issue

@ColtonVan
Copy link

一样的问题

@ColtonVan
Copy link

这个包是不维护了吗?

@KieronWiltshire
Copy link

Is this resolved yet?

@chary1n
Copy link

chary1n commented Jun 15, 2022

Is this resolved yet?

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

@laiyazhou
Copy link

same issue

1 similar comment
@vantrung1408
Copy link

same issue

@KieronWiltshire
Copy link

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

@michaldziuba03
Copy link

michaldziuba03 commented Jan 14, 2023

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.

@ZhaoKunLong
Copy link

ZhaoKunLong commented Aug 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests