{ "source": "doc/api/cli.md", "miscs": [ { "textRaw": "Command Line Options", "name": "Command Line Options", "type": "misc", "desc": "

Node.js comes with a variety of CLI options. These options expose built-in\ndebugging, multiple ways to execute scripts, and other helpful runtime options.

\n

To view this documentation as a manual page in your terminal, run man node.

\n", "miscs": [ { "textRaw": "Synopsis", "name": "synopsis", "desc": "

node [options] [v8 options] [script.js | -e "script"] [--] [arguments]

\n

node debug [script.js | -e "script" | <host>:<port>] …

\n

node --v8-options

\n

Execute without arguments to start the REPL.

\n

For more info about node debug, please see the debugger documentation.

\n", "type": "misc", "displayName": "Synopsis" }, { "textRaw": "Options", "name": "options", "modules": [ { "textRaw": "`-v`, `--version`", "name": "`-v`,_`--version`", "meta": { "added": [ "v0.1.3" ] }, "desc": "

Print node's version.

\n", "type": "module", "displayName": "`-v`, `--version`" }, { "textRaw": "`-h`, `--help`", "name": "`-h`,_`--help`", "meta": { "added": [ "v0.1.3" ] }, "desc": "

Print node command line options.\nThe output of this option is less detailed than this document.

\n", "type": "module", "displayName": "`-h`, `--help`" }, { "textRaw": "`-e`, `--eval \"script\"`", "name": "`-e`,_`--eval_\"script\"`", "meta": { "added": [ "v0.5.2" ] }, "desc": "

Evaluate the following argument as JavaScript. The modules which are\npredefined in the REPL can also be used in script.

\n", "type": "module", "displayName": "`-e`, `--eval \"script\"`" }, { "textRaw": "`-p`, `--print \"script\"`", "name": "`-p`,_`--print_\"script\"`", "meta": { "added": [ "v0.6.4" ] }, "desc": "

Identical to -e but prints the result.

\n", "type": "module", "displayName": "`-p`, `--print \"script\"`" }, { "textRaw": "`-c`, `--check`", "name": "`-c`,_`--check`", "meta": { "added": [ "v5.0.0" ] }, "desc": "

Syntax check the script without executing.

\n", "type": "module", "displayName": "`-c`, `--check`" }, { "textRaw": "`-i`, `--interactive`", "name": "`-i`,_`--interactive`", "meta": { "added": [ "v0.7.7" ] }, "desc": "

Opens the REPL even if stdin does not appear to be a terminal.

\n", "type": "module", "displayName": "`-i`, `--interactive`" }, { "textRaw": "`-r`, `--require module`", "name": "`-r`,_`--require_module`", "meta": { "added": [ "v1.6.0" ] }, "desc": "

Preload the specified module at startup.

\n

Follows require()'s module resolution\nrules. module may be either a path to a file, or a node module name.

\n", "type": "module", "displayName": "`-r`, `--require module`" }, { "textRaw": "`--no-deprecation`", "name": "`--no-deprecation`", "meta": { "added": [ "v0.8.0" ] }, "desc": "

Silence deprecation warnings.

\n", "type": "module", "displayName": "`--no-deprecation`" }, { "textRaw": "`--trace-deprecation`", "name": "`--trace-deprecation`", "meta": { "added": [ "v0.8.0" ] }, "desc": "

Print stack traces for deprecations.

\n", "type": "module", "displayName": "`--trace-deprecation`" }, { "textRaw": "`--throw-deprecation`", "name": "`--throw-deprecation`", "meta": { "added": [ "v0.11.14" ] }, "desc": "

Throw errors for deprecations.

\n", "type": "module", "displayName": "`--throw-deprecation`" }, { "textRaw": "`--no-warnings`", "name": "`--no-warnings`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Silence all process warnings (including deprecations).

\n", "type": "module", "displayName": "`--no-warnings`" }, { "textRaw": "`--trace-warnings`", "name": "`--trace-warnings`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Print stack traces for process warnings (including deprecations).

\n", "type": "module", "displayName": "`--trace-warnings`" }, { "textRaw": "`--trace-sync-io`", "name": "`--trace-sync-io`", "meta": { "added": [ "v2.1.0" ] }, "desc": "

Prints a stack trace whenever synchronous I/O is detected after the first turn\nof the event loop.

\n", "type": "module", "displayName": "`--trace-sync-io`" }, { "textRaw": "`--zero-fill-buffers`", "name": "`--zero-fill-buffers`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Automatically zero-fills all newly allocated Buffer and SlowBuffer\ninstances.

\n", "type": "module", "displayName": "`--zero-fill-buffers`" }, { "textRaw": "`--preserve-symlinks`", "name": "`--preserve-symlinks`", "meta": { "added": [ "v6.3.0" ] }, "desc": "

Instructs the module loader to preserve symbolic links when resolving and\ncaching modules.

\n

By default, when Node.js loads a module from a path that is symbolically linked\nto a different on-disk location, Node.js will dereference the link and use the\nactual on-disk "real path" of the module as both an identifier and as a root\npath to locate other dependency modules. In most cases, this default behavior\nis acceptable. However, when using symbolically linked peer dependencies, as\nillustrated in the example below, the default behavior causes an exception to\nbe thrown if moduleA attempts to require moduleB as a peer dependency:

\n
{appDir}\n ├── app\n │   ├── index.js\n │   └── node_modules\n │       ├── moduleA -> {appDir}/moduleA\n │       └── moduleB\n │           ├── index.js\n │           └── package.json\n └── moduleA\n     ├── index.js\n     └── package.json\n
\n

The --preserve-symlinks command line flag instructs Node.js to use the\nsymlink path for modules as opposed to the real path, allowing symbolically\nlinked peer dependencies to be found.

\n

Note, however, that using --preserve-symlinks can have other side effects.\nSpecifically, symbolically linked native modules can fail to load if those\nare linked from more than one location in the dependency tree (Node.js would\nsee those as two separate modules and would attempt to load the module multiple\ntimes, causing an exception to be thrown).

\n", "type": "module", "displayName": "`--preserve-symlinks`" }, { "textRaw": "`--track-heap-objects`", "name": "`--track-heap-objects`", "meta": { "added": [ "v2.4.0" ] }, "desc": "

Track heap object allocations for heap snapshots.

\n", "type": "module", "displayName": "`--track-heap-objects`" }, { "textRaw": "`--prof-process`", "name": "`--prof-process`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Process v8 profiler output generated using the v8 option --prof.

\n", "type": "module", "displayName": "`--prof-process`" }, { "textRaw": "`--v8-options`", "name": "`--v8-options`", "meta": { "added": [ "v0.1.3" ] }, "desc": "

Print v8 command line options.

\n

Note: v8 options allow words to be separated by both dashes (-) or underscores\n(_).

\n

For example, --stack-trace-limit is equivalent to --stack_trace_limit.

\n", "type": "module", "displayName": "`--v8-options`" }, { "textRaw": "`--tls-cipher-list=list`", "name": "`--tls-cipher-list=list`", "meta": { "added": [ "v4.0.0" ] }, "desc": "

Specify an alternative default TLS cipher list. (Requires Node.js to be built\nwith crypto support. (Default))

\n", "type": "module", "displayName": "`--tls-cipher-list=list`" }, { "textRaw": "`--enable-fips`", "name": "`--enable-fips`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with\n./configure --openssl-fips)

\n", "type": "module", "displayName": "`--enable-fips`" }, { "textRaw": "`--force-fips`", "name": "`--force-fips`", "meta": { "added": [ "v6.0.0" ] }, "desc": "

Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)\n(Same requirements as --enable-fips)

\n", "type": "module", "displayName": "`--force-fips`" }, { "textRaw": "`--openssl-config=file`", "name": "`--openssl-config=file`", "meta": { "added": [ "v6.9.0" ] }, "desc": "

Load an OpenSSL configuration file on startup. Among other uses, this can be\nused to enable FIPS-compliant crypto if Node.js is built with\n./configure --openssl-fips.

\n", "type": "module", "displayName": "`--openssl-config=file`" }, { "textRaw": "`--use-openssl-ca`, `--use-bundled-ca`", "name": "`--use-openssl-ca`,_`--use-bundled-ca`", "meta": { "added": [ "v6.11.0" ] }, "desc": "

Use OpenSSL's default CA store or use bundled Mozilla CA store as supplied by\ncurrent NodeJS version. The default store is selectable at build-time.

\n

Using OpenSSL store allows for external modifications of the store. For most\nLinux and BSD distributions, this store is maintained by the distribution\nmaintainers and system administrators. OpenSSL CA store location is dependent on\nconfiguration of the OpenSSL library but this can be altered at runtime using\nenvironmental variables.

\n

The bundled CA store, as supplied by NodeJS, is a snapshot of Mozilla CA store\nthat is fixed at release time. It is identical on all supported platforms.

\n

See SSL_CERT_DIR and SSL_CERT_FILE.

\n", "type": "module", "displayName": "`--use-openssl-ca`, `--use-bundled-ca`" }, { "textRaw": "`--icu-data-dir=file`", "name": "`--icu-data-dir=file`", "meta": { "added": [ "v0.11.15" ] }, "desc": "

Specify ICU data load path. (overrides NODE_ICU_DATA)

\n", "type": "module", "displayName": "`--icu-data-dir=file`" }, { "textRaw": "`--`", "name": "`--`", "meta": { "added": [ "v6.11.0" ] }, "desc": "

Indicate the end of node options. Pass the rest of the arguments to the script.\nIf no script filename or eval/print script is supplied prior to this, then\nthe next argument will be used as a script filename.

\n", "type": "module", "displayName": "`--`" } ], "type": "misc", "displayName": "Options" }, { "textRaw": "Environment Variables", "name": "environment_variables", "modules": [ { "textRaw": "`NODE_DEBUG=module[,…]`", "name": "`node_debug=module[,…]`", "meta": { "added": [ "v0.1.32" ] }, "desc": "

','-separated list of core modules that should print debug information.

\n", "type": "module", "displayName": "`NODE_DEBUG=module[,…]`" }, { "textRaw": "`NODE_PATH=path[:…]`", "name": "`node_path=path[:…]`", "meta": { "added": [ "v0.1.32" ] }, "desc": "

':'-separated list of directories prefixed to the module search path.

\n

Note: on Windows, this is a ';'-separated list instead.

\n", "type": "module", "displayName": "`NODE_PATH=path[:…]`" }, { "textRaw": "`NODE_DISABLE_COLORS=1`", "name": "`node_disable_colors=1`", "meta": { "added": [ "v0.3.0" ] }, "desc": "

When set to 1 colors will not be used in the REPL.

\n", "type": "module", "displayName": "`NODE_DISABLE_COLORS=1`" }, { "textRaw": "`NODE_ICU_DATA=file`", "name": "`node_icu_data=file`", "meta": { "added": [ "v0.11.15" ] }, "desc": "

Data path for ICU (Intl object) data. Will extend linked-in data when compiled\nwith small-icu support.

\n", "type": "module", "displayName": "`NODE_ICU_DATA=file`" }, { "textRaw": "`NODE_NO_WARNINGS=1`", "name": "`node_no_warnings=1`", "meta": { "added": [ "v6.11.0" ] }, "desc": "

When set to 1, process warnings are silenced.

\n", "type": "module", "displayName": "`NODE_NO_WARNINGS=1`" }, { "textRaw": "`NODE_REPL_HISTORY=file`", "name": "`node_repl_history=file`", "meta": { "added": [ "v3.0.0" ] }, "desc": "

Path to the file used to store the persistent REPL history. The default path is\n~/.node_repl_history, which is overridden by this variable. Setting the value\nto an empty string ("" or " ") disables persistent REPL history.

\n", "type": "module", "displayName": "`NODE_REPL_HISTORY=file`" }, { "textRaw": "`NODE_TTY_UNSAFE_ASYNC=1`", "name": "`node_tty_unsafe_async=1`", "meta": { "added": [ "6.4.0" ] }, "desc": "

When set to 1, writes to stdout and stderr will be non-blocking and\nasynchronous when outputting to a TTY on platforms which support async stdio.\nSetting this will void any guarantee that stdio will not be interleaved or\ndropped at program exit. Use of this mode is not recommended.

\n", "type": "module", "displayName": "`NODE_TTY_UNSAFE_ASYNC=1`" }, { "textRaw": "`NODE_EXTRA_CA_CERTS=file`", "name": "`node_extra_ca_certs=file`", "desc": "

When set, the well known "root" CAs (like VeriSign) will be extended with the\nextra certificates in file. The file should consist of one or more trusted\ncertificates in PEM format. A message will be emitted (once) with\nprocess.emitWarning() if the file is missing or\nmalformed, but any errors are otherwise ignored.

\n

Note that neither the well known nor extra certificates are used when the ca\noptions property is explicitly specified for a TLS or HTTPS client or server.

\n", "type": "module", "displayName": "`NODE_EXTRA_CA_CERTS=file`" }, { "textRaw": "`OPENSSL_CONF=file`", "name": "`openssl_conf=file`", "meta": { "added": [ "v6.11.0" ] }, "desc": "

Load an OpenSSL configuration file on startup. Among other uses, this can be\nused to enable FIPS-compliant crypto if Node.js is built with ./configure\n\\-\\-openssl\\-fips.

\n

If the --openssl-config command line option is used, the environment\nvariable is ignored.

\n", "type": "module", "displayName": "`OPENSSL_CONF=file`" }, { "textRaw": "`SSL_CERT_DIR=dir`", "name": "`ssl_cert_dir=dir`", "desc": "

If --use-openssl-ca is enabled, this overrides and sets OpenSSL's directory\ncontaining trusted certificates.

\n

Note: Be aware that unless the child environment is explicitly set, this\nevironment variable will be inherited by any child processes, and if they use\nOpenSSL, it may cause them to trust the same CAs as node.

\n", "type": "module", "displayName": "`SSL_CERT_DIR=dir`" }, { "textRaw": "`SSL_CERT_FILE=file`", "name": "`ssl_cert_file=file`", "desc": "

If --use-openssl-ca is enabled, this overrides and sets OpenSSL's file\ncontaining trusted certificates.

\n

Note: Be aware that unless the child environment is explicitly set, this\nevironment variable will be inherited by any child processes, and if they use\nOpenSSL, it may cause them to trust the same CAs as node.

\n", "type": "module", "displayName": "`SSL_CERT_FILE=file`" } ], "type": "misc", "displayName": "Environment Variables" } ] } ] }