Skip to content

Commit fded7e9

Browse files
Update errors.md
1 parent 8b5822f commit fded7e9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/faq/errors.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ During your development with NestJS, you may encounter various errors as you lea
44

55
#### "Cannot resolve dependency" error
66

7+
> info **Hint** Check out the [NestJS Devtools](/devtools/overview#investigating-the-cannot-resolve-dependency-error) which can help you resolve the "Cannot resolve dependency" error effortlessly.
8+
79
Probably the most common error message is about Nest not being able to resolve dependencies of a provider. The error message usually looks something like this:
810

911
```bash
@@ -20,8 +22,6 @@ Potential solutions:
2022
2123
The most common culprit of the error, is not having the `<provider>` in the module's `providers` array. Please make sure that the provider is indeed in the `providers` array and following [standard NestJS provider practices](/fundamentals/custom-providers#di-fundamentals).
2224

23-
<app-banner-devtools></app-banner-devtools>
24-
2525
There are a few gotchas, that are common. One is putting a provider in an `imports` array. If this is the case, the error will have the provider's name where `<module>` should be.
2626
2727
If you run across this error while developing, take a look at the module mentioned in the error message and look at its `providers`. For each provider in the `providers` array, make sure the module has access to all of the dependencies. Often times, `providers` are duplicated in a "Feature Module" and a "Root Module" which means Nest will try to instantiate the provider twice. More than likely, the module containing the `<provider>` being duplicated should be added in the "Root Module"'s `imports` array instead.
@@ -32,6 +32,8 @@ If the `<unknown_token>` above is the string `Object`, it means that you're inje
3232
3333
Also, make sure you didn't end up injecting the provider on itself because self-injections are not allowed in NestJS. When this happens, `<unknown_token>` will likely be equal to `<provider>`.
3434

35+
<app-banner-devtools></app-banner-devtools>
36+
3537
If you are in a **monorepo setup**, you may face the same error as above but for core provider called `ModuleRef` as a `<unknown_token>`:
3638

3739
```bash

0 commit comments

Comments
 (0)