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.
See original GitHub issueIs 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"
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Nest can't resolve dependencies of the ... - GitHub
Nest can't resolve dependencies of the DiscoveryService (?). Please make sure that the argument ModulesContainer at index [0] #10396.
Read more >Nest can't resolve dependencies of the DiscoveryService ...
Please make sure that the argument ModulesContainer at index [0] is available in the DiscoveryModule context. Error log. Potential solutions: If ...
Read more >NestJS: Resolving Dependency Injection - Tevpro
Nest can't resolve dependencies of the AuthController (?). Please make sure that the argument dependency at index [0] is available in the AuthModule...
Read more >Nest can't resolve dependencies of the UsersService ... - Reddit
Please make sure that the argument PrismaService at index [0] is available in the UsersService context. I've read about 30 different S.O./reddit ...
Read more >nest can't resolve dependencies of the httpservice - You.com
Error : Nest can't resolve dependencies of the YoutubeService (?). Please make sure that the argument HttpService at index [0] is available in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Questions as in the question set class, not the inquirer service itself
Yeah. I understood that , but I needed appmodule to be imported in my commandmodule . And also some module exporter by appmodule.
Thx