#Nestjs watch mode doesn't restart server
12 messages · Page 1 of 1 (latest)
Please run the command npx -y @nestjs/cli info and paste the output in a code block. This will help us determine if there is a version issue in your packages and which version of nest we are triaging.
Command failed with exit code 1: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
'powershell' is not recognized as an internal or external command,
operable program or batch file
[System Information]
OS Version : Windows 10
NodeJS Version : v20.11.0
NPM Version : 8.19.2
[Nest CLI]
Nest CLI Version : 10.2.1
[Nest Platform Information]
platform-express version : 10.3.0
mapped-types version : 2.0.4
schematics version : 10.0.3
typeorm version : 10.0.1
testing version : 10.3.0
common version : 10.3.0
config version : 3.1.1
core version : 10.3.0
cli version : 10.2.1
Windows users who are using TypeScript version 4.9 and up may encounter this problem.
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:
XX:XX:XX AM - File change detected. Starting incremental compilation...
XX:XX:XX AM - Found 0 errors. Watching for file changes.
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 for detecting file changes is used which is likely to be the cause of this problem.
In order to fix this problem, you need to add a setting to your tsconfig.json file after the "compilerOptions" option as follows:
{
"watchOptions": {
"watchFile": "fixedPollingInterval"
}
}
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.
You can read more about the "watchFile" option in TypeScript documentation.
it doesn't help, i am using typescript 5.1.3
@full umbra
Try upgrading Nest CLI to the latest verison.
I updated it to 10.3.2 but issue the issue is still remaining @lapis briar
@willow river - I have no more ideas, if you did the suggestions above. Can you run npx -y @nestjs/cli info again please and post the results here?
[System Information]
OS Version : Windows 10.0.22621
NodeJS Version : v20.11.0
NPM Version : 8.19.2
[Nest CLI]
Nest CLI Version : 10.3.2
[Nest Platform Information]
platform-express version : 10.3.0
mapped-types version : 2.0.4
schematics version : 10.0.3
typeorm version : 10.0.1
testing version : 10.3.0
common version : 10.3.0
config version : 3.1.1
core version : 10.3.0
cli version : 10.3.2
Sorry, no ideas. 🤷🏻♂️ These are the kind of quirks in dev'ing with Windows that made me move to Linux. I tried WSL too, but it was also quirky depending on what I needed to do.