samholmes
samholmes2mo ago

`deno task dev` not working because `--watch` doesn't detect changes

I've run deno task dev on a new project from deno init and so it should be running the task deno run --watch main.ts . But when I change main.ts the command does not re-run. The output remains statically:
deno task dev
Watcher File change detected! Restarting!
Add 2 + 3 = 5
Watcher Process finished. Restarting on file change...
deno task dev
Watcher File change detected! Restarting!
Add 2 + 3 = 5
Watcher Process finished. Restarting on file change...
What am I doing wrong? I'm using Deno 2.0.4, Warp as my terminal, and zsh as my shell. I'm on macOS 14.2.1. Is this a bug?
3 Replies
John Adams
John Adams2mo ago
It's probably running correctly, when Watcher reruns your file it clears the terminal so you won't always see previous output. So if the output isn't changing then you'll have a hard time noticing that the file was rerun unless you have it print something different on each file change. If you want to test this you could try an experiment and have it log the current time, if it's not printing the new current time each time you save the file then there might be a problem. Also you should consider updating your Mac. Sonoma 14.7.1 is available or you can upgrade to Squoia 15.1. Regardless, you're running nearly a whole year behind on security updates!
bartlomieju
bartlomieju2mo ago
Can you open an issue on github?
samholmes
samholmesOP4w ago
I think I can do that