Skip to content

Commit b7d8a55

Browse files
Merge pull request #2103 from jmcdo29/feat/errors-update
feat: add mention of `dependency` dependency errors
2 parents a753b9d + 03eee40 commit b7d8a55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/faq/errors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ There are a few gotchas, that are common. One is putting a provider in an `impor
2424
2525
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.
2626

27+
If the `unknown_token` above is the string `dependency`, you might have a circular file import. This is different from the [circular dependency](./errors.md#circular-dependency-error) below because instead of having providers depend on each other in their constructors, it just means that two files end up importing each other. A common case would be a module file declaring a token and importing a provider, and the provider import the token constant from the module file. If you are using barrel files, ensure that your barrel imports do not end up creating these circular imports as well.
28+
2729
#### "Circular dependency" error
2830

2931
Occasionally you'll find it difficult to avoid [circular dependencies](/fundamentals/circular-dependency) in your application. You'll need to take some steps to help Nest resolve these. Errors that arise from circular dependencies look like this:

0 commit comments

Comments
 (0)