Skip to content

Commit d69af3b

Browse files
authored
Added a new section
1 parent 51735dc commit d69af3b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

content/faq/errors.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Nest can't resolve dependencies of the <provider> (?). Please make sure that the
1111
1212
Potential solutions:
1313
- Is <module> a valid NestJS module?
14-
- If <unknown_token> is a provider, is it part of the current <module>?
14+
- If <unknown_token> is a provider, is it part of the current <module>?
1515
- If <unknown_token> is exported from a separate @Module, is that module imported within <module>?
1616
@Module({
1717
imports: [ /* the Module containing <unknown_token> */ ]
@@ -84,3 +84,21 @@ Along with just manually verifying your dependencies are correct, as of Nest 8.1
8484
<figure><img src="/assets/injector_logs.png" /></figure>
8585
8686
In the above image, the string in yellow is the host class of the dependency being injected, the string in blue is the name of the injected dependency, or its injection token, and the string in purple is the module in which the dependency is being searched for. Using this, you can usually trace back the dependency resolution for what's happening and why you're getting dependency injection problems.
87+
88+
#### "File change detected" loops endlessly
89+
90+
Windows users who are using TypeScript version 4.9 and up may encounter this problem.
91+
This happens when you're trying to run your application in watch mode, e.g `npm run start:dev` and see an endless loop of the log messages:
92+
```bash
93+
XX:XX:XX AM - File change detected. Starting incremental compilation...
94+
XX:XX:XX AM - Found 0 errors. Watching for file changes.
95+
```
96+
When you're using the NestJS CLI to start your application in watch mode it is done by calling `tsc --watch`, and as of version 4.9 of TypeScript, a [new method](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#file-watching-now-uses-file-system-events) for detecting file changes is used which is the cause of this problem.
97+
In order to fix this problem, you need to add a setting to your tsconfig.json file after the `"compilerOptions"` option as follows:
98+
```bash
99+
"watchOptions": {
100+
"watchFile": "fixedPollingInterval"
101+
}
102+
```
103+
This tells TypeScript to use the polling method for checking for file changes instead of file system events (the new default method), which can cause issues on some machines.
104+
You can read more about the `"watchFile"` options you can use in [this link](https://www.typescriptlang.org/tsconfig#watch-watchDirectory).

0 commit comments

Comments
 (0)