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
Currently, --watch watches an inode and not necessarily what the user might consider a "file". This can cause confusion on systems that write to disk by deleting the old file and then creating a new one.
For example, when using Docker Compose's watch mode, the watched file is first deleted. When a new file is created Node currently fails to restart on file changes, as node is still watching the inode of the deleted file, and doesn't react to the new file being created.
What is the feature you are proposing to solve the problem?
While this behavior makes sense for the lower-level and more "raw" fs.watch(), perhaps the more general --watch behavior can be expanded to be smarter about detecting replaced files. Alternatively, a new flag can be introduced with this behavior.
What alternatives have you considered?
Other alternatives require using one of the different file watcher libs. That seems like a step down from the otherwise awesome native watch feature.
This is always a problem and sync+restart is not ideal because it completely restarts the container, and we lose time in some cases (tailwindcss, Next.js)
The problem is not present in Deno and Bun
I've created a repository, with which you can try https://github.com/Yovach/compose-watch-js-runtimes
EDIT: tsx doesn't support watching replaced files, but nodemon seems to support it.
So if you're using Node.js, you'll need to use nodemon if you want to watch changes
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
benjamingr commentedon Feb 2, 2024
@MoLow
MoLow commentedon Feb 4, 2024
IIUC the underlying fix for this would probably be in libuv.
debadree25 commentedon Feb 5, 2024
Any ideas on where and libuv apis one can look to modify to implement this would be great to know! giving a shot to investigating this
mstaicu commentedon Jul 23, 2024
Any updates on this?
add nodemon back until node --watch is fixed nodejs/node#51621
ruscon commentedon Aug 13, 2024
As a temporary solution, I use docker compose
action: sync+restartinstead ofaction: sync.RaiPeter commentedon Feb 7, 2025
took me days to figure this out as I was exploring this watch feature on docker, thanks @ruscon for giving a workaround. Very helpful.
🐛 Switch back to using volume mount for test_api container.
Yovach commentedon Aug 2, 2025
This is always a problem and
sync+restartis not ideal because it completely restarts the container, and we lose time in some cases (tailwindcss, Next.js)The problem is not present in Deno and Bun
I've created a repository, with which you can try https://github.com/Yovach/compose-watch-js-runtimes
EDIT:
tsxdoesn't support watching replaced files, butnodemonseems to support it.So if you're using Node.js, you'll need to use
nodemonif you want to watch changesgithub-actions commentedon Jan 30, 2026
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the never-staleIssues and PRs exempt from automated stale handling.
label or close this issue if it should be closed. If not, the issue will be automatically closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
4 remaining items
Swapped Ghost core use of node --watch to nodemon for Docker hot reload
marcopiraccini commentedon Jun 13, 2026
This is a proposal to fix this: #63888
github-actions commentedon Sep 12, 2026
This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
chbybnwr commentedon Sep 12, 2026
bot, no
watch: detect files replaced via unlink and create
mstaicu commentedon Sep 27, 2026
Pinch me as I must be dreaming. Can't believe this got addressed
watch: detect files replaced via unlink and create
watch: detect files replaced via unlink and create
watch: detect files replaced via unlink and create