nest-commander: Error: Nest can't resolve dependencies of the InquirerService (?, DiscoveryService). Please make sure that the argument Symbol(Inquirer) at index [0] is available in the CommandModule context.
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
Import InquirerService to constructor of Command class.
Minimum reproduction code
export class BasicCommand extends CommandRunner {
constructor(private readonly inquirerService: InquirerService) {
super()
}
...
}
import { Module } from '@nestjs/common';
import { CreateAdminCommand } from "../commands/create-admin.command";
import { CreateAdminQuestions } from "../commands/questions/create-admin.questions";
import { InquirerService } from "nest-commander";
@Module({
imports: [],
providers: [
CreateAdminCommand,
CreateAdminQuestions,
InquirerService,
],
exports: [],
})
export class CommandModule {
}
Expected behavior
Not get error:
[Nest] 5184 - 09/13/2022, 8:57:24 AM ERROR [ExceptionHandler] Nest can't resolve dependencies of the InquirerService (?, DiscoveryService). Please make sure that the argument Symbol(Inquirer) at index [0] is available in the CommandModule context.
Potential solutions:
- If Symbol(Inquirer) is a provider, is it part of the current CommandModule?
- If Symbol(Inquirer) is exported from a separate @Module, is that module imported within CommandModule?
@Module({
imports: [ /* the Module containing Symbol(Inquirer) */ ]
})
Error: Nest can't resolve dependencies of the InquirerService (?, DiscoveryService). Please make sure that the argument Symbol(Inquirer) at index [0] is available in the CommandModule context.
Potential solutions:
- If Symbol(Inquirer) is a provider, is it part of the current CommandModule?
- If Symbol(Inquirer) is exported from a separate @Module, is that module imported within CommandModule?
@Module({
imports: [ /* the Module containing Symbol(Inquirer) */ ]
})
at Injector.lookupComponentInParentModules (/work/node_modules/@nestjs/core/injector/injector.js:202:19)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Injector.resolveComponentInstance (/work/node_modules/@nestjs/core/injector/injector.js:157:33)
at resolveParam (/work/node_modules/@nestjs/core/injector/injector.js:108:38)
at async Promise.all (index 0)
at Injector.resolveConstructorParams (/work/node_modules/@nestjs/core/injector/injector.js:123:27)
at Injector.loadInstance (/work/node_modules/@nestjs/core/injector/injector.js:52:9)
at Injector.loadProvider (/work/node_modules/@nestjs/core/injector/injector.js:74:9)
at async Promise.all (index 5)
at InstanceLoader.createInstancesOfProviders (/work/node_modules/@nestjs/core/injector/instance-loader.js:44:9)
Package
-
nest-commander
-
nest-commander-schematics
-
nest-commander-testing
Package version
3.1.0
Node.js version
14.16.1
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
@types/inquirer": "^8.2.3"
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (6 by maintainers)
@ab192130 Please open a new issue with a minimum reproduction or create a new discussion topic instead of posting on a solved closed issue
Yeah. I understood that , but I needed appmodule to be imported in my commandmodule . And also some module exporter by appmodule.
Thx
Questions as in the question set class, not the inquirer service itself