42-TRANSENDENCE / backend

transcendence backend
MIT License
1 stars 0 forks source link

[Error] : gateway  에 Service  에 있는 함수 가져와서 쓰려고 했는데 에러발생.. #63

Closed maindishes closed 1 year ago

maindishes commented 1 year ago
maindishes commented 1 year ago
[Nest] 40535  - 03/18/2023, 2:12:06 PM   ERROR [ExceptionHandler] Nest can't resolve dependencies of the ChannelsService (ChannelsRepository, UserRepository, ChannelMemberRepository, ?). Please make sure that the argument dependency at index [3] is available in the ChannelsModule context.

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

Error: Nest can't resolve dependencies of the ChannelsService (ChannelsRepository, UserRepository, ChannelMemberRepository, ?). Please make sure that the argument dependency at index [3] is available in the ChannelsModule context.

Potential solutions:
- Is ChannelsModule a valid NestJS module?
- If dependency is a provider, is it part of the current ChannelsModule?
- If dependency is exported from a separate @Module, is that module imported within ChannelsModule?
  @Module({
    imports: [ /* the Module containing dependency */ ]
  })
maindishes commented 1 year ago
[Nest] 41682  - 03/18/2023, 2:53:31 PM   ERROR [ExceptionHandler] Classes annotated with @Injectable(), @Catch(), and @Controller() decorators must not appear in the "imports" array of a module.
Please remove "ChannelsService" (including forwarded occurrences, if any) from all of the "imports" arrays.

Scope [AppModule -> ChatsModule -> EventsModule]

Error: Classes annotated with @Injectable(), @Catch(), and @Controller() decorators must not appear in the "imports" array of a module.
Please remove "ChannelsService" (including forwarded occurrences, if any) from all of the "imports" arrays.

Scope [AppModule -> ChatsModule -> EventsModule]

    at DependenciesScanner.insertModule (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:76:19)
    at DependenciesScanner.scanForModules (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:34:43)
    at DependenciesScanner.scanForModules (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:61:43)
    at DependenciesScanner.scanForModules (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:61:32)
    at DependenciesScanner.scanForModules (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:61:32)
    at DependenciesScanner.scan (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/scanner.js:27:9)
    at /Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/nest-factory.js:107:17
    at Function.asyncRun (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/errors/exceptions-zone.js:22:13)
    at NestFactoryStatic.initialize (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/nest-factory.js:106:13)
    at NestFactoryStatic.create (/Users/jyp/Desktop/programming/42seoul/transcendence/together/backend/node_modules/@nestjs/core/nest-factory.js:42:9)
maindishes commented 1 year ago

forwardRef(() => UsersModule) this keyword  사용 !! 서로 참조하는 양쪽에 다 해줘야 한다 ! https://docs.nestjs.com/fundamentals/circular-dependency