node --watch app.jsBuilt-in watch mode is stable in current Node releases and useful for local development.
Node.js CLI recipes for watch mode, built-in tests, REPL usage, shebang scripts, and practical automation patterns.
Use watch mode, built-in tests, the REPL, and script recipes.
node --watch app.jsBuilt-in watch mode is stable in current Node releases and useful for local development.
node --watch-path=src --watch-path=config app.jsGood for reducing restart noise in larger projects.
node --testUseful for projects using the native node:test module.
node --test --watchConvenient during development of native test suites.
nodeRun Node without arguments to start the REPL.
NODE_REPL_HISTORY=$HOME/.node_repl_history nodeHelpful when you use the REPL heavily across sessions.
#!/usr/bin/env node
console.log('hello from a Node CLI')Place this at the top of executable JS files to create custom CLIs.
Separate Node flags from script arguments.
node --trace-warnings app.js -- --port=3000 --verbose`--` tells Node to stop parsing its own flags and pass the rest to your script.