You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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