Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Nest can't resolve dependencies of the AidController (?). Please make sure that the argument AidService at index [0] is available in the AidModule

This one has me stumped after I tried a few things such as export AidService from the AidModule and that did not work.

import { Module } from '@nestjs/common';
import { AidController } from './aid.controller';

@Module({
  controllers: [AidController],
})
export class AidModule {}

I don’t think its asking me to import AidService into AidModule.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

AidService does not exist in the context of the module so you have to add it as a provider and your controller would be able to resolve it.

import { Module } from '@nestjs/common';
import { AidController } from './aid.controller';

@Module({
  controllers: [AidController],
  providers: [AirService]
})
export class AidModule {}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading