#Live reload not working on windows 11

38 messages · Page 1 of 1 (latest)

ocean sun
#

I have used almost every method described to fix this whether from NestJs common errors, downgrading ts version and including this server as well, which already has 2 of these issues asked. I am using windows 11.

last garnet
#

got a repository to share? Otherwise I don't think we can help you out

ocean sun
#

Sure But its been happening with every Nest Project on my PC including a nx monorepo as well and through different ts versions as well. So I will share one if you need

crystal nebula
#

Did you try a reboot? 😁

ocean sun
#

Yes ofc, also have tried reinstalling even nodejs, let alone nestCli

crystal nebula
#

What is the log if you set DEBUG=* and NEST_DEBUG=true env variables (don't know how that's done on windows).

ocean sun
#

you mean these logs
[Nest] 10400 - 24/01/2024, 8:33:15 pm LOG [NestApplication] Nest application successfully started +2345ms
[Nest] 10400 - 24/01/2024, 8:33:15 pm LOG 🚀 Application is running on: http://localhost:3000
if I add these variables to my env file?
If yes then no errors as such, just the mapping info, but I did found this log which I don't understand,
express:router use '/' <anonymous> +10ms
express:router:layer new '/' +0ms
express:router use '/' <anonymous> +2ms
express:router:layer new '/' +0ms
anyways Idk if its useful

crystal nebula
ocean sun
#

sorry if I didn't phrase my response or question correctly, ofc it starts correctly but doesn't reload on change and no logs are there once a change is made thus it is stuck on waiting for file changes

#

Additionally I have tested the same code (multiple repos) and watch mode works perfectly in MacOs

crystal nebula
#

Live reload not working on windows 11

ocean sun
#

Normal Drive. Tried the solution but now it doesn't even work detects a file change when adding wathcOptions to tsconfig.buid.json and gets stuck if I add the same wathcOptions to tsconfig.json

#

So I didn't check the backend for a few days as I was working on Azure and FrontEnd. Was trying to install Openssl and deleted my path in environment vars, then reinstalled everything back and I believe since then this issue started appearing. Here are ss of path env:

  1. User
  2. System
#

Although Idk if its related to it

crystal nebula
#

I don't have other ideas, as I don't develop on Windows, sorry. I'm almost certain that it's not a Nest issue, that any typescript project will have the same issue.
You could google for "windows typescript live reload not working", maybe you'll find something, until someone using win eventually helps here.

ocean sun
#

Ok Well I have researched for tsc --watch not working as well 😁. But anyways thanks for your help.

hallow crow
ocean sun
elder carbonBOT
#

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.

hallow crow
#

did you also try fixedPollingInterval?

ocean sun
#

Yes

#
#

I have tried almost everything as I been working on this issue for at least a full day now as without live/hot reload I can't work properly. And Have tried hot reload using webpack.hmr method from Nest docs but that also doesn't work after 2+ changes just compiles and doesn't run the code. Also there is no typechecking in it

hallow crow
ocean sun
#

vsCode and powershell

#

*Recently updated wsl as well (if useful to this convo)

#

Tried running on Wsl as well, same problem

hallow crow
ocean sun
#

nope*

#

its the same from the start

hallow crow
# ocean sun nope*

if you believe it only happens on your side, try testing with another editor and terminal, like the git bash or the command prompt

ocean sun
#

Tried reinstalling vscode and tried running on cmd. Yet the same problem 🙃

hallow crow
# ocean sun Tried reinstalling vscode and tried running on cmd. Yet the same problem 🙃

I suggested testing with another editor because they have different methods of saving file changes on disk.
some might truncate and rewrite the entire file, some might only update what is changed, and others may create a temporary file, delete the original one, and then move the temporary file to the correct location. if you leave their settings by default, they choose whichever works best based on file system permissions. some might confuse tsc's watch mode.
I don't think "reinstalling" it makes any difference because the editor's configuration usually remains the same :v

ocean sun
#

Ok I will give it a try

ocean sun
#

So an update, I tried a random solution from stack overflow which was to create a new resource nest g resource xxxxx --no-spec. It works but only when I change anything in this particular resource. Still doesn't work anywhere else.