Node.js CLI

Node.js CLI cheat sheets for runtime flags, debugging, watch mode, test runner, environment variables, and production execution patterns.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Basics and Invocation

Inspect runtime, run scripts, eval code, and use stdin.

Print Node version

Show the current Node.js version.

bashANYnodeversion
bash
node --version
Notes

Check which runtime is active in your shell, CI job, or container.

Show CLI help

Print built-in CLI help.

bashANYnodehelp
bash
node --help
Notes

Lists available flags and basic usage for the installed runtime.

Print V8 options

List V8 engine flags.

bashANYnodev8
bash
node --v8-options
Notes

Useful for memory and GC tuning research.

Run a script file

Execute a JavaScript entry file.

bashANYnoderun
bash
node app.js
Notes

Standard way to launch a Node program.

Execute inline JavaScript

Run a one-liner directly from the shell.

bashANYnodeeval
bash
node -e "console.log(process.version)"
Notes

Good for quick checks, shell automation, and CI probes.

Print expression result

Evaluate an expression and print its result.

bashANYnodeprint
bash
node -p "process.platform + ' ' + process.arch"
Notes

`-p` is useful in scripts where you want the value printed automatically.

Run script from stdin

Feed JavaScript to Node from standard input.

bashANYnodestdin
bash
echo "console.log('hello from stdin')" | node -
Notes

Useful in pipelines or generated scripts.

Syntax check a file

Validate syntax without executing the program.

bashANYnodesyntax
bash
node --check app.js
Notes

Helpful in CI or quick validation of generated JavaScript files.

Recommended next

No recommendations yet.