Nest can't resolve dependencies of the FileController

Viewed 22

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

My employee app module .

@Module({
  imports: [
    DataServicesModule,
    EmployeeModule,
    CarModule,
    CategoryModule,
    RoleModule,
    FileModule,
  ],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useClass: ResponseInterceptor,
    }
  ],
})
export class AppModule { }

only when I use FileModul it gives this error.

I can't find this error since 4-5 days .

please help to solve this problem .

github link: https://github.com/abbos-yaxyoyev/car-avtomobile

1 Answers

I wasn't able to fully answer this but hopefully this will help. I'm wondering whether it might have something to do with your file directory structure?

The problem, judging by the error message, is because of the fileService: FileUseCases parameter in your FileController constructor.

Check list:

  • You have provided the service in the providers array in the File.module.ts. - Good
  • FileUseCases (fileService) is injectable - Good
  • Are you using FileUseCases in any other module? Is it possible there's a circular dependency?

File.module.ts

https://github.com/abbos-yaxyoyev/car-avtomobile/blob/main/src/employee/module/file.module.ts

File.use-case.ts

https://github.com/abbos-yaxyoyev/car-avtomobile/blob/main/src/common/use-case/file/file.use-case.ts

Related