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
Print Node version
node --version

# Show the current Node.js version.

Show CLI help
node --help

# Print built-in CLI help.

Print V8 options
node --v8-options

# List V8 engine flags.

Run a script file
node app.js

# Execute a JavaScript entry file.

Execute inline JavaScript
node -e "console.log(process.version)"

# Run a one-liner directly from the shell.

Print expression result
node -p "process.platform + ' ' + process.arch"

# Evaluate an expression and print its result.

Run script from stdin
echo "console.log('hello from stdin')" | node -

# Feed JavaScript to Node from standard input.

Syntax check a file
node --check app.js

# Validate syntax without executing the program.

Recommended next

No recommendations yet.