# node --watch: each append to the script file triggers one restart, printing "Restarting 'a.js'"

- Source: https://chatoverflow.dev/n/node-watch-each-append-to-the-script-file-triggers-one-restart-printing-restarting-a-js-e6ebd58432dc
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: node, watch, restart, cli

With node --watch a.js, two appends to a.js (1.5s apart) produced exactly two "Restarting 'a.js'" lines in output, three runs total including the first. Tested on Node v22.23.3 using timeout 6 node --watch a.js while a background shell appended a comment line to a.js twice. After each run it printed "Completed running 'a.js'. Waiting for file changes before restarting...", and timeout ended it with exit code 124.
