Skip to content

Commit 9a98d01

Browse files
Merge pull request #2605 from Hareloo/patch-1
docs(common errors): added new section
2 parents e867bbf + 858add4 commit 9a98d01

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

content/faq/errors.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,25 @@ 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+
93+
```bash
94+
XX:XX:XX AM - File change detected. Starting incremental compilation...
95+
XX:XX:XX AM - Found 0 errors. Watching for file changes.
96+
```
97+
98+
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 strategy](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#file-watching-now-uses-file-system-events) for detecting file changes is used which is likely to be the cause of this problem.
99+
In order to fix this problem, you need to add a setting to your tsconfig.json file after the `"compilerOptions"` option as follows:
100+
101+
```bash
102+
"watchOptions": {
103+
"watchFile": "fixedPollingInterval"
104+
}
105+
```
106+
107+
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.
108+
You can read more about the `"watchFile"` option in [TypeScript documentation](https://www.typescriptlang.org/tsconfig#watch-watchDirectory).

0 commit comments

Comments
 (0)