command-line flag
An option typed after a program's name to change how it runs, such as --watch in node --watch server.js.
In more detail
Node.js flags go before the script name; anything after it is passed to your program in process.argv. NODE_OPTIONS can supply flags through the environment instead.
Related terms
- command-line interface — A program you control by typing commands as text in a terminal instead of clicking in a window.
- NODE_OPTIONS — An environment variable holding command-line options that every node process started in that environment applies, including child processes.
- argument vector — The list of separate strings a program is started with: its own name followed by each argument.
Taught in
- V8 Engine & JIT Pipeline: Bytecode & Turbofan — Node.js Internals & Backend Services
- Runtime Configuration: CLI Flags & Native --env-file — Node.js Internals & Backend Services
- Native Test Runner: node:test & node:assert/strict — Node.js Internals & Backend Services