{ "type": "module", "source": "doc/api/cli.md", "introduced_in": "v5.9.1", "miscs": [ { "textRaw": "Command-line API", "name": "Command-line API", "introduced_in": "v5.9.1", "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.
\nTo view this documentation as a manual page in a terminal, run man node
.
node [options] [V8 options] [<program-entry-point> | -e \"script\" | -] [--] [arguments]
node inspect [<program-entry-point> | -e \"script\" | <host>:<port>] …
node --v8-options
Execute without arguments to start the REPL.
\nFor more info about node inspect
, see the debugger documentation.
The program entry point is a specifier-like string. If the string is not an\nabsolute path, it's resolved as a relative path from the current working\ndirectory. That path is then resolved by CommonJS module loader, or by the\nES module loader if --experimental-default-type=module
\nis passed. If no corresponding file is found, an error is thrown.
If a file is found, its path will be passed to the\nES module loader under any of the following conditions:
\n--import
or\n--experimental-default-type=module
..mjs
extension..cjs
extension, and the nearest parent\npackage.json
file contains a top-level \"type\"
field with a value of\n\"module\"
.Otherwise, the file is loaded using the CommonJS module loader. See\nModules loaders for more details.
", "modules": [ { "textRaw": "ECMAScript modules loader entry point caveat", "name": "ecmascript_modules_loader_entry_point_caveat", "desc": "When loading, the ES module loader loads the program\nentry point, the node
command will accept as input only files with .js
,\n.mjs
, or .cjs
extensions; with .wasm
extensions when\n--experimental-wasm-modules
is enabled; and with no extension when\n--experimental-default-type=module
is passed.
All options, including V8 options, allow words to be separated by both\ndashes (-
) or underscores (_
). For example, --pending-deprecation
is\nequivalent to --pending_deprecation
.
If an option that takes a single value (such as --max-http-header-size
) is\npassed more than once, then the last passed value is used. Options from the\ncommand line take precedence over options passed through the NODE_OPTIONS
\nenvironment variable.
Alias for stdin. Analogous to the use of -
in other command-line utilities,\nmeaning that the script is read from stdin, and the rest of the options\nare passed to that script.
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 is used as a script filename.
", "type": "module", "displayName": "`--`" }, { "textRaw": "`--abort-on-uncaught-exception`", "name": "`--abort-on-uncaught-exception`", "meta": { "added": [ "v0.10.8" ], "changes": [] }, "desc": "Aborting instead of exiting causes a core file to be generated for post-mortem\nanalysis using a debugger (such as lldb
, gdb
, and mdb
).
If this flag is passed, the behavior can still be set to not abort through\nprocess.setUncaughtExceptionCaptureCallback()
(and through usage of the\nnode:domain
module that uses it).
Generates a snapshot blob when the process exits and writes it to\ndisk, which can be loaded later with --snapshot-blob
.
When building the snapshot, if --snapshot-blob
is not specified,\nthe generated blob will be written, by default, to snapshot.blob
\nin the current working directory. Otherwise it will be written to\nthe path specified by --snapshot-blob
.
$ echo \"globalThis.foo = 'I am from the snapshot'\" > snapshot.js\n\n# Run snapshot.js to initialize the application and snapshot the\n# state of it into snapshot.blob.\n$ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js\n\n$ echo \"console.log(globalThis.foo)\" > index.js\n\n# Load the generated snapshot and start the application from index.js.\n$ node --snapshot-blob snapshot.blob index.js\nI am from the snapshot\n
\nThe v8.startupSnapshot
API can be used to specify an entry point at\nsnapshot building time, thus avoiding the need of an additional entry\nscript at deserialization time:
$ echo \"require('v8').startupSnapshot.setDeserializeMainFunction(() => console.log('I am from the snapshot'))\" > snapshot.js\n$ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js\n$ node --snapshot-blob snapshot.blob\nI am from the snapshot\n
\nFor more information, check out the v8.startupSnapshot
API documentation.
Currently the support for run-time snapshot is experimental in that:
\nPrint source-able bash completion script for Node.js.
\n$ node --completion-bash > node_bash_completion\n$ source node_bash_completion\n
",
"type": "module",
"displayName": "`--completion-bash`"
},
{
"textRaw": "`-C condition`, `--conditions=condition`",
"name": "`-c_condition`,_`--conditions=condition`",
"meta": {
"added": [
"v14.9.0",
"v12.19.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Enable experimental support for custom conditional exports resolution\nconditions.
\nAny number of custom string condition names are permitted.
\nThe default Node.js conditions of \"node\"
, \"default\"
, \"import\"
, and\n\"require\"
will always apply as defined.
For example, to run a module with \"development\" resolutions:
\n$ node -C development app.js\n
",
"type": "module",
"displayName": "`-C condition`, `--conditions=condition`"
},
{
"textRaw": "`--cpu-prof`",
"name": "`--cpu-prof`",
"meta": {
"added": [
"v12.0.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Starts the V8 CPU profiler on start up, and writes the CPU profile to disk\nbefore exit.
\nIf --cpu-prof-dir
is not specified, the generated profile is placed\nin the current working directory.
If --cpu-prof-name
is not specified, the generated profile is\nnamed CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile
.
$ node --cpu-prof index.js\n$ ls *.cpuprofile\nCPU.20190409.202950.15293.0.0.cpuprofile\n
",
"type": "module",
"displayName": "`--cpu-prof`"
},
{
"textRaw": "`--cpu-prof-dir`",
"name": "`--cpu-prof-dir`",
"meta": {
"added": [
"v12.0.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Specify the directory where the CPU profiles generated by --cpu-prof
will\nbe placed.
The default value is controlled by the\n--diagnostic-dir
command-line option.
Specify the sampling interval in microseconds for the CPU profiles generated\nby --cpu-prof
. The default is 1000 microseconds.
Specify the file name of the CPU profile generated by --cpu-prof
.
Set the directory to which all diagnostic output files are written.\nDefaults to current working directory.
\nAffects the default output directory of:
\n", "type": "module", "displayName": "`--diagnostic-dir=directory`" }, { "textRaw": "`--disable-proto=mode`", "name": "`--disable-proto=mode`", "meta": { "added": [ "v13.12.0", "v12.17.0" ], "changes": [] }, "desc": "Disable the Object.prototype.__proto__
property. If mode
is delete
, the\nproperty is removed entirely. If mode
is throw
, accesses to the\nproperty throw an exception with the code ERR_PROTO_ACCESS
.
Make built-in language features like eval
and new Function
that generate\ncode from strings throw an exception instead. This does not affect the Node.js\nnode:vm
module.
Set the default value of verbatim
in dns.lookup()
and\ndnsPromises.lookup()
. The value could be:
ipv4first
: sets default verbatim
false
.verbatim
: sets default verbatim
true
.The default is verbatim
and dns.setDefaultResultOrder()
have higher\npriority than --dns-result-order
.
Enable FIPS-compliant crypto at startup. (Requires Node.js to be built\nagainst FIPS-compatible OpenSSL.)
", "type": "module", "displayName": "`--enable-fips`" }, { "textRaw": "`--enable-network-family-autoselection`", "name": "`--enable-network-family-autoselection`", "meta": { "added": [ "v18.18.0" ], "changes": [] }, "desc": "Enables the family autoselection algorithm unless connection options explicitly\ndisables it.
", "type": "module", "displayName": "`--enable-network-family-autoselection`" }, { "textRaw": "`--enable-source-maps`", "name": "`--enable-source-maps`", "meta": { "added": [ "v12.12.0" ], "changes": [ { "version": [ "v15.11.0", "v14.18.0" ], "pr-url": "https://github.com/nodejs/node/pull/37362", "description": "This API is no longer experimental." } ] }, "desc": "Enable Source Map v3 support for stack traces.
\nWhen using a transpiler, such as TypeScript, stack traces thrown by an\napplication reference the transpiled code, not the original source position.\n--enable-source-maps
enables caching of Source Maps and makes a best\neffort to report stack traces relative to the original source file.
Overriding Error.prepareStackTrace
prevents --enable-source-maps
from\nmodifying the stack trace.
Note, enabling source maps can introduce latency to your application\nwhen Error.stack
is accessed. If you access Error.stack
frequently\nin your application, take into account the performance implications\nof --enable-source-maps
.
Expose the CustomEvent Web API on the global scope.
", "type": "module", "displayName": "`--experimental-global-customevent`" }, { "textRaw": "`--experimental-global-webcrypto`", "name": "`--experimental-global-webcrypto`", "meta": { "added": [ "v17.6.0" ], "changes": [] }, "desc": "Expose the Web Crypto API on the global scope.
", "type": "module", "displayName": "`--experimental-global-webcrypto`" }, { "textRaw": "`--experimental-default-type=type`", "name": "`--experimental-default-type=type`", "meta": { "added": [ "v18.19.0" ], "changes": [] }, "stability": 1, "stabilityText": ".0 - Early development", "desc": "Define which module system, module
or commonjs
, to use for the following:
String input provided via --eval
or STDIN, if --input-type
is unspecified.
Files ending in .js
or with no extension, if there is no package.json
file\npresent in the same folder or any parent folder.
Files ending in .js
or with no extension, if the nearest parent\npackage.json
field lacks a \"type\"
field; unless the package.json
folder\nor any parent folder is inside a node_modules
folder.
In other words, --experimental-default-type=module
flips all the places where\nNode.js currently defaults to CommonJS to instead default to ECMAScript modules,\nwith the exception of folders and subfolders below node_modules
, for backward\ncompatibility.
Under --experimental-default-type=module
and --experimental-wasm-modules
,\nfiles with no extension will be treated as WebAssembly if they begin with the\nWebAssembly magic number (\\0asm
); otherwise they will be treated as ES module\nJavaScript.
Enable experimental import.meta.resolve()
parent URL support, which allows\npassing a second parentURL
argument for contextual resolution.
Previously gated the entire import.meta.resolve
feature.
\n\nThis flag is discouraged and may be removed in a future version of Node.js.\nPlease use\n
\n--import
withregister()
instead.
Specify the module
containing exported module customization hooks.\nmodule
may be any string accepted as an import
specifier.
Enable experimental support for the https:
protocol in import
specifiers.
Use the specified file as a security policy.
", "type": "module", "displayName": "`--experimental-policy`" }, { "textRaw": "`--no-experimental-fetch`", "name": "`--no-experimental-fetch`", "meta": { "added": [ "v18.0.0" ], "changes": [] }, "desc": "Disable experimental support for the Fetch API.
", "type": "module", "displayName": "`--no-experimental-fetch`" }, { "textRaw": "`--no-experimental-repl-await`", "name": "`--no-experimental-repl-await`", "meta": { "added": [ "v16.6.0" ], "changes": [] }, "desc": "Use this flag to disable top-level await in REPL.
", "type": "module", "displayName": "`--no-experimental-repl-await`" }, { "textRaw": "`--experimental-shadow-realm`", "name": "`--experimental-shadow-realm`", "meta": { "added": [ "v18.13.0" ], "changes": [] }, "desc": "Use this flag to enable ShadowRealm support.
", "type": "module", "displayName": "`--experimental-shadow-realm`" }, { "textRaw": "`--experimental-specifier-resolution=mode`", "name": "`--experimental-specifier-resolution=mode`", "meta": { "added": [ "v13.4.0", "v12.16.0" ], "changes": [] }, "desc": "Sets the resolution algorithm for resolving ES module specifiers. Valid options\nare explicit
and node
.
The default is explicit
, which requires providing the full path to a\nmodule. The node
mode enables support for optional file extensions and\nthe ability to import a directory that has an index file.
See customizing ESM specifier resolution for example usage.
", "type": "module", "displayName": "`--experimental-specifier-resolution=mode`" }, { "textRaw": "`--experimental-test-coverage`", "name": "`--experimental-test-coverage`", "meta": { "added": [ "v18.15.0" ], "changes": [ { "version": "v18.17.0", "pr-url": "https://github.com/nodejs/node/pull/47686", "description": "This option can be used with `--test`." } ] }, "desc": "When used in conjunction with the node:test
module, a code coverage report is\ngenerated as part of the test runner output. If no tests are run, a coverage\nreport is not generated. See the documentation on\ncollecting code coverage from tests for more details.
Enable experimental ES Module support in the node:vm
module.
Enable experimental WebAssembly System Interface (WASI) support.
", "type": "module", "displayName": "`--experimental-wasi-unstable-preview1`" }, { "textRaw": "`--experimental-wasm-modules`", "name": "`--experimental-wasm-modules`", "meta": { "added": [ "v12.3.0" ], "changes": [] }, "desc": "Enable experimental WebAssembly module support.
", "type": "module", "displayName": "`--experimental-wasm-modules`" }, { "textRaw": "`--force-context-aware`", "name": "`--force-context-aware`", "meta": { "added": [ "v12.12.0" ], "changes": [] }, "desc": "Disable loading native addons that are not context-aware.
", "type": "module", "displayName": "`--force-context-aware`" }, { "textRaw": "`--force-fips`", "name": "`--force-fips`", "meta": { "added": [ "v6.0.0" ], "changes": [] }, "desc": "Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)\n(Same requirements as --enable-fips
.)
Enable experimental frozen intrinsics like Array
and Object
.
Only the root context is supported. There is no guarantee that\nglobalThis.Array
is indeed the default intrinsic reference. Code may break\nunder this flag.
To allow polyfills to be added,\n--require
and --import
both run before freezing intrinsics.
Enforces uncaughtException
event on Node-API asynchronous callbacks.
To prevent from an existing add-on from crashing the process, this flag is not\nenabled by default. In the future, this flag will be enabled by default to\nenforce the correct behavior.
", "type": "module", "displayName": "`--force-node-api-uncaught-exceptions-policy`" }, { "textRaw": "`--heapsnapshot-near-heap-limit=max_count`", "name": "`--heapsnapshot-near-heap-limit=max_count`", "meta": { "added": [ "v15.1.0", "v14.18.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the\nheap limit. count
should be a non-negative integer (in which case\nNode.js will write no more than max_count
snapshots to disk).
When generating snapshots, garbage collection may be triggered and bring\nthe heap usage down. Therefore multiple snapshots may be written to disk\nbefore the Node.js instance finally runs out of memory. These heap snapshots\ncan be compared to determine what objects are being allocated during the\ntime consecutive snapshots are taken. It's not guaranteed that Node.js will\nwrite exactly max_count
snapshots to disk, but it will try\nits best to generate at least one and up to max_count
snapshots before the\nNode.js instance runs out of memory when max_count
is greater than 0
.
Generating V8 snapshots takes time and memory (both memory managed by the\nV8 heap and native memory outside the V8 heap). The bigger the heap is,\nthe more resources it needs. Node.js will adjust the V8 heap to accommodate\nthe additional V8 heap memory overhead, and try its best to avoid using up\nall the memory available to the process. When the process uses\nmore memory than the system deems appropriate, the process may be terminated\nabruptly by the system, depending on the system configuration.
\n$ node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js\nWrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot\nWrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot\nWrote snapshot to Heap.20200430.100038.49580.0.003.heapsnapshot\n\n<--- Last few GCs --->\n\n[49580:0x110000000] 4826 ms: Mark-sweep 130.6 (147.8) -> 130.5 (147.8) MB, 27.4 / 0.0 ms (average mu = 0.126, current mu = 0.034) allocation failure scavenge might not succeed\n[49580:0x110000000] 4845 ms: Mark-sweep 130.6 (147.8) -> 130.6 (147.8) MB, 18.8 / 0.0 ms (average mu = 0.088, current mu = 0.031) allocation failure scavenge might not succeed\n\n\n<--- JS stacktrace --->\n\nFATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory\n....\n
",
"type": "module",
"displayName": "`--heapsnapshot-near-heap-limit=max_count`"
},
{
"textRaw": "`--heapsnapshot-signal=signal`",
"name": "`--heapsnapshot-signal=signal`",
"meta": {
"added": [
"v12.0.0"
],
"changes": []
},
"desc": "Enables a signal handler that causes the Node.js process to write a heap dump\nwhen the specified signal is received. signal
must be a valid signal name.\nDisabled by default.
$ node --heapsnapshot-signal=SIGUSR2 index.js &\n$ ps aux\nUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND\nnode 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js\n$ kill -USR2 1\n$ ls\nHeap.20190718.133405.15554.0.001.heapsnapshot\n
",
"type": "module",
"displayName": "`--heapsnapshot-signal=signal`"
},
{
"textRaw": "`--heap-prof`",
"name": "`--heap-prof`",
"meta": {
"added": [
"v12.4.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Starts the V8 heap profiler on start up, and writes the heap profile to disk\nbefore exit.
\nIf --heap-prof-dir
is not specified, the generated profile is placed\nin the current working directory.
If --heap-prof-name
is not specified, the generated profile is\nnamed Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile
.
$ node --heap-prof index.js\n$ ls *.heapprofile\nHeap.20190409.202950.15293.0.001.heapprofile\n
",
"type": "module",
"displayName": "`--heap-prof`"
},
{
"textRaw": "`--heap-prof-dir`",
"name": "`--heap-prof-dir`",
"meta": {
"added": [
"v12.4.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Specify the directory where the heap profiles generated by --heap-prof
will\nbe placed.
The default value is controlled by the\n--diagnostic-dir
command-line option.
Specify the average sampling interval in bytes for the heap profiles generated\nby --heap-prof
. The default is 512 * 1024 bytes.
Specify the file name of the heap profile generated by --heap-prof
.
Specify ICU data load path. (Overrides NODE_ICU_DATA
.)
Preload the specified module at startup.
\nFollows ECMAScript module resolution rules.\nUse --require
to load a CommonJS module.\nModules preloaded with --require
will run before modules preloaded with --import
.
This configures Node.js to interpret string input as CommonJS or as an ES\nmodule. String input is input via --eval
, --print
, or STDIN
.
Valid values are \"commonjs\"
and \"module\"
. The default is \"commonjs\"
.
The REPL does not support this option.
", "type": "module", "displayName": "`--input-type=type`" }, { "textRaw": "`--inspect-brk[=[host:]port]`", "name": "`--inspect-brk[=[host:]port]`", "meta": { "added": [ "v7.6.0" ], "changes": [] }, "desc": "Activate inspector on host:port
and break at start of user script.\nDefault host:port
is 127.0.0.1:9229
.
Set the host:port
to be used when the inspector is activated.\nUseful when activating the inspector by sending the SIGUSR1
signal.
Default host is 127.0.0.1
.
See the security warning below regarding the host
\nparameter usage.
Activate inspector on host:port
. Default is 127.0.0.1:9229
.
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug\nand profile Node.js instances. The tools attach to Node.js instances via a\ntcp port and communicate using the Chrome DevTools Protocol.
\n\n", "modules": [ { "textRaw": "Warning: binding inspector to a public IP:port combination is insecure", "name": "warning:_binding_inspector_to_a_public_ip:port_combination_is_insecure", "desc": "Binding the inspector to a public IP (including 0.0.0.0
) with an open port is\ninsecure, as it allows external hosts to connect to the inspector and perform\na remote code execution attack.
If specifying a host, make sure that either:
\nMore specifically, --inspect=0.0.0.0
is insecure if the port (9229
by\ndefault) is not firewall-protected.
See the debugging security implications section for more information.
", "type": "module", "displayName": "Warning: binding inspector to a public IP:port combination is insecure" } ], "type": "module", "displayName": "`--inspect[=[host:]port]`" }, { "textRaw": "`--inspect-publish-uid=stderr,http`", "name": "`--inspect-publish-uid=stderr,http`", "desc": "Specify ways of the inspector web socket url exposure.
\nBy default inspector websocket url is available in stderr and under /json/list
\nendpoint on http://host:port/json/list
.
Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow\ninteroperability with non-conformant HTTP implementations. It may also allow\nrequest smuggling and other HTTP attacks that rely on invalid headers being\naccepted. Avoid using this option.
", "type": "module", "displayName": "`--insecure-http-parser`" }, { "textRaw": "`--jitless`", "name": "`--jitless`", "meta": { "added": [ "v12.0.0" ], "changes": [] }, "desc": "Disable runtime allocation of executable memory. This may be\nrequired on some platforms for security reasons. It can also reduce attack\nsurface on other platforms, but the performance impact may be severe.
\nThis flag is inherited from V8 and is subject to change upstream. It may\ndisappear in a non-semver-major release.
", "type": "module", "displayName": "`--jitless`" }, { "textRaw": "`--max-http-header-size=size`", "name": "`--max-http-header-size=size`", "meta": { "added": [ "v11.6.0", "v10.15.0" ], "changes": [ { "version": "v13.13.0", "pr-url": "https://github.com/nodejs/node/pull/32520", "description": "Change maximum default size of HTTP headers from 8 KiB to 16 KiB." } ] }, "desc": "Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.
", "type": "module", "displayName": "`--max-http-header-size=size`" }, { "textRaw": "`--napi-modules`", "name": "`--napi-modules`", "meta": { "added": [ "v7.10.0" ], "changes": [] }, "desc": "This option is a no-op. It is kept for compatibility.
", "type": "module", "displayName": "`--napi-modules`" }, { "textRaw": "`--no-addons`", "name": "`--no-addons`", "meta": { "added": [ "v16.10.0", "v14.19.0" ], "changes": [] }, "desc": "Disable the node-addons
exports condition as well as disable loading\nnative addons. When --no-addons
is specified, calling process.dlopen
or\nrequiring a native C++ addon will fail and throw an exception.
Silence deprecation warnings.
", "type": "module", "displayName": "`--no-deprecation`" }, { "textRaw": "`--no-extra-info-on-fatal-exception`", "name": "`--no-extra-info-on-fatal-exception`", "meta": { "added": [ "v17.0.0" ], "changes": [] }, "desc": "Hide extra information on fatal exception that causes exit.
", "type": "module", "displayName": "`--no-extra-info-on-fatal-exception`" }, { "textRaw": "`--no-force-async-hooks-checks`", "name": "`--no-force-async-hooks-checks`", "meta": { "added": [ "v9.0.0" ], "changes": [] }, "desc": "Disables runtime checks for async_hooks
. These will still be enabled\ndynamically when async_hooks
is enabled.
Do not search modules from global paths like $HOME/.node_modules
and\n$NODE_PATH
.
Silence all process warnings (including deprecations).
", "type": "module", "displayName": "`--no-warnings`" }, { "textRaw": "`--node-memory-debug`", "name": "`--node-memory-debug`", "meta": { "added": [ "v15.0.0", "v14.18.0" ], "changes": [] }, "desc": "Enable extra debug checks for memory leaks in Node.js internals. This is\nusually only useful for developers debugging Node.js itself.
", "type": "module", "displayName": "`--node-memory-debug`" }, { "textRaw": "`--openssl-config=file`", "name": "`--openssl-config=file`", "meta": { "added": [ "v6.9.0" ], "changes": [] }, "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\nagainst FIPS-enabled OpenSSL.
", "type": "module", "displayName": "`--openssl-config=file`" }, { "textRaw": "`--openssl-shared-config`", "name": "`--openssl-shared-config`", "meta": { "added": [ "v18.5.0" ], "changes": [] }, "desc": "Enable OpenSSL default configuration section, openssl_conf
to be read from\nthe OpenSSL configuration file. The default configuration file is named\nopenssl.cnf
but this can be changed using the environment variable\nOPENSSL_CONF
, or by using the command line option --openssl-config
.\nThe location of the default OpenSSL configuration file depends on how OpenSSL\nis being linked to Node.js. Sharing the OpenSSL configuration may have unwanted\nimplications and it is recommended to use a configuration section specific to\nNode.js which is nodejs_conf
and is default when this option is not used.
Enable OpenSSL 3.0 legacy provider. For more information please see\nOSSL_PROVIDER-legacy.
", "type": "module", "displayName": "`--openssl-legacy-provider`" }, { "textRaw": "`--pending-deprecation`", "name": "`--pending-deprecation`", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "desc": "Emit pending deprecation warnings.
\nPending deprecations are generally identical to a runtime deprecation with the\nnotable exception that they are turned off by default and will not be emitted\nunless either the --pending-deprecation
command-line flag, or the\nNODE_PENDING_DEPRECATION=1
environment variable, is set. Pending deprecations\nare used to provide a kind of selective \"early warning\" mechanism that\ndevelopers may leverage to detect deprecated API usage.
Instructs Node.js to error prior to running any code if the policy does not have\nthe specified integrity. It expects a Subresource Integrity string as a\nparameter.
", "type": "module", "displayName": "`--policy-integrity=sri`" }, { "textRaw": "`--preserve-symlinks`", "name": "`--preserve-symlinks`", "meta": { "added": [ "v6.3.0" ], "changes": [] }, "desc": "Instructs the module loader to preserve symbolic links when resolving and\ncaching modules.
\nBy 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:
{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
\nThe --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.
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).
The --preserve-symlinks
flag does not apply to the main module, which allows\nnode --preserve-symlinks node_module/.bin/<foo>
to work. To apply the same\nbehavior for the main module, also use --preserve-symlinks-main
.
Instructs the module loader to preserve symbolic links when resolving and\ncaching the main module (require.main
).
This flag exists so that the main module can be opted-in to the same behavior\nthat --preserve-symlinks
gives to all other imports; they are separate flags,\nhowever, for backward compatibility with older Node.js versions.
--preserve-symlinks-main
does not imply --preserve-symlinks
; use\n--preserve-symlinks-main
in addition to\n--preserve-symlinks
when it is not desirable to follow symlinks before\nresolving relative paths.
See --preserve-symlinks
for more information.
Generate V8 profiler output.
", "type": "module", "displayName": "`--prof`" }, { "textRaw": "`--prof-process`", "name": "`--prof-process`", "meta": { "added": [ "v5.2.0" ], "changes": [] }, "desc": "Process V8 profiler output generated using the V8 option --prof
.
Write process warnings to the given file instead of printing to stderr. The\nfile will be created if it does not exist, and will be appended to if it does.\nIf an error occurs while attempting to write the warning to the file, the\nwarning will be written to stderr instead.
\nThe file
name may be an absolute path. If it is not, the default directory it\nwill be written to is controlled by the\n--diagnostic-dir
command-line option.
Write reports in a compact format, single-line JSON, more easily consumable\nby log processing systems than the default multi-line format designed for\nhuman consumption.
", "type": "module", "displayName": "`--report-compact`" }, { "textRaw": "`--report-dir=directory`, `report-directory=directory`", "name": "`--report-dir=directory`,_`report-directory=directory`", "meta": { "added": [ "v11.8.0" ], "changes": [ { "version": [ "v13.12.0", "v12.17.0" ], "pr-url": "https://github.com/nodejs/node/pull/32242", "description": "This option is no longer experimental." }, { "version": "v12.0.0", "pr-url": "https://github.com/nodejs/node/pull/27312", "description": "Changed from `--diagnostic-report-directory` to `--report-directory`." } ] }, "desc": "Location at which the report will be generated.
", "type": "module", "displayName": "`--report-dir=directory`, `report-directory=directory`" }, { "textRaw": "`--report-filename=filename`", "name": "`--report-filename=filename`", "meta": { "added": [ "v11.8.0" ], "changes": [ { "version": [ "v13.12.0", "v12.17.0" ], "pr-url": "https://github.com/nodejs/node/pull/32242", "description": "This option is no longer experimental." }, { "version": "v12.0.0", "pr-url": "https://github.com/nodejs/node/pull/27312", "description": "changed from `--diagnostic-report-filename` to `--report-filename`." } ] }, "desc": "Name of the file to which the report will be written.
\nIf the filename is set to 'stdout'
or 'stderr'
, the report is written to\nthe stdout or stderr of the process respectively.
Enables the report to be triggered on fatal errors (internal errors within\nthe Node.js runtime such as out of memory) that lead to termination of the\napplication. Useful to inspect various diagnostic data elements such as heap,\nstack, event loop state, resource consumption etc. to reason about the fatal\nerror.
", "type": "module", "displayName": "`--report-on-fatalerror`" }, { "textRaw": "`--report-on-signal`", "name": "`--report-on-signal`", "meta": { "added": [ "v11.8.0" ], "changes": [ { "version": [ "v13.12.0", "v12.17.0" ], "pr-url": "https://github.com/nodejs/node/pull/32242", "description": "This option is no longer experimental." }, { "version": "v12.0.0", "pr-url": "https://github.com/nodejs/node/pull/27312", "description": "changed from `--diagnostic-report-on-signal` to `--report-on-signal`." } ] }, "desc": "Enables report to be generated upon receiving the specified (or predefined)\nsignal to the running Node.js process. The signal to trigger the report is\nspecified through --report-signal
.
Sets or resets the signal for report generation (not supported on Windows).\nDefault signal is SIGUSR2
.
Enables report to be generated when the process exits due to an uncaught\nexception. Useful when inspecting the JavaScript stack in conjunction with\nnative stack and other runtime environment data.
", "type": "module", "displayName": "`--report-uncaught-exception`" }, { "textRaw": "`--secure-heap=n`", "name": "`--secure-heap=n`", "meta": { "added": [ "v15.6.0" ], "changes": [] }, "desc": "Initializes an OpenSSL secure heap of n
bytes. When initialized, the\nsecure heap is used for selected types of allocations within OpenSSL\nduring key generation and other operations. This is useful, for instance,\nto prevent sensitive information from leaking due to pointer overruns\nor underruns.
The secure heap is a fixed size and cannot be resized at runtime so,\nif used, it is important to select a large enough heap to cover all\napplication uses.
\nThe heap size given must be a power of two. Any value less than 2\nwill disable the secure heap.
\nThe secure heap is disabled by default.
\nThe secure heap is not available on Windows.
\nSee CRYPTO_secure_malloc_init
for more details.
When using --secure-heap
, the --secure-heap-min
flag specifies the\nminimum allocation from the secure heap. The minimum value is 2
.\nThe maximum value is the lesser of --secure-heap
or 2147483647
.\nThe value given must be a power of two.
When used with --build-snapshot
, --snapshot-blob
specifies the path\nwhere the generated snapshot blob is written to. If not specified, the\ngenerated blob is written to snapshot.blob
in the current working directory.
When used without --build-snapshot
, --snapshot-blob
specifies the\npath to the blob that is used to restore the application state.
When loading a snapshot, Node.js checks that:
\nIf they don't match, Node.js refuses to load the snapshot and exits with\nstatus code 1.
", "type": "module", "displayName": "`--snapshot-blob=path`" }, { "textRaw": "`--test`", "name": "`--test`", "meta": { "added": [ "v18.1.0" ], "changes": [ { "version": "v18.13.0", "pr-url": "https://github.com/nodejs/node/pull/45214", "description": "Test runner now supports running in watch mode." } ] }, "desc": "Starts the Node.js command line test runner. This flag cannot be combined with\n--watch-path
, --check
, --eval
, --interactive
, or the inspector.\nSee the documentation on running tests from the command line\nfor more details.
The maximum number of test files that the test runner CLI will execute\nconcurrently. The default value is os.availableParallelism() - 1
.
A regular expression that configures the test runner to only execute tests\nwhose name matches the provided pattern. See the documentation on\nfiltering tests by name for more details.
", "type": "module", "displayName": "`--test-name-pattern`" }, { "textRaw": "`--test-reporter`", "name": "`--test-reporter`", "meta": { "added": [ "v18.15.0" ], "changes": [] }, "desc": "A test reporter to use when running tests. See the documentation on\ntest reporters for more details.
", "type": "module", "displayName": "`--test-reporter`" }, { "textRaw": "`--test-reporter-destination`", "name": "`--test-reporter-destination`", "meta": { "added": [ "v18.15.0" ], "changes": [] }, "desc": "The destination for the corresponding test reporter. See the documentation on\ntest reporters for more details.
", "type": "module", "displayName": "`--test-reporter-destination`" }, { "textRaw": "`--test-only`", "name": "`--test-only`", "meta": { "added": [ "v18.0.0" ], "changes": [] }, "desc": "Configures the test runner to only execute top level tests that have the only
\noption set.
Test suite shard to execute in a format of <index>/<total>
, where
index
is a positive integer, index of divided parts\ntotal
is a positive integer, total of divided part\nThis command will divide all tests files into total
equal parts,\nand will run only those that happen to be in an index
part.
For example, to split your tests suite into three parts, use this:
\nnode --test --test-shard=1/3\nnode --test --test-shard=2/3\nnode --test --test-shard=3/3\n
",
"type": "module",
"displayName": "`--test-shard`"
},
{
"textRaw": "`--throw-deprecation`",
"name": "`--throw-deprecation`",
"meta": {
"added": [
"v0.11.14"
],
"changes": []
},
"desc": "Throw errors for deprecations.
", "type": "module", "displayName": "`--throw-deprecation`" }, { "textRaw": "`--title=title`", "name": "`--title=title`", "meta": { "added": [ "v10.7.0" ], "changes": [] }, "desc": "Set process.title
on startup.
Specify an alternative default TLS cipher list. Requires Node.js to be built\nwith crypto support (default).
", "type": "module", "displayName": "`--tls-cipher-list=list`" }, { "textRaw": "`--tls-keylog=file`", "name": "`--tls-keylog=file`", "meta": { "added": [ "v13.2.0", "v12.16.0" ], "changes": [] }, "desc": "Log TLS key material to a file. The key material is in NSS SSLKEYLOGFILE
\nformat and can be used by software (such as Wireshark) to decrypt the TLS\ntraffic.
Set tls.DEFAULT_MAX_VERSION
to 'TLSv1.2'. Use to disable support for\nTLSv1.3.
Set default tls.DEFAULT_MAX_VERSION
to 'TLSv1.3'. Use to enable support\nfor TLSv1.3.
Set default tls.DEFAULT_MIN_VERSION
to 'TLSv1'. Use for compatibility with\nold TLS clients or servers.
Set default tls.DEFAULT_MIN_VERSION
to 'TLSv1.1'. Use for compatibility\nwith old TLS clients or servers.
Set default tls.DEFAULT_MIN_VERSION
to 'TLSv1.2'. This is the default for\n12.x and later, but the option is supported for compatibility with older Node.js\nversions.
Set default tls.DEFAULT_MIN_VERSION
to 'TLSv1.3'. Use to disable support\nfor TLSv1.2, which is not as secure as TLSv1.3.
Print short summaries of calls to Atomics.wait()
to stderr.\nThe output could look like this:
(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started\n(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched\n(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started\n(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out\n(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started\n(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started\n(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread\n(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread\n
\nThe fields here correspond to:
\nworker_threads.threadId
SharedArrayBuffer
in question, as well as the\nbyte offset corresponding to the index passed to Atomics.wait()
Atomics.wait()
Atomics.wait
Print stack traces for deprecations.
", "type": "module", "displayName": "`--trace-deprecation`" }, { "textRaw": "`--trace-event-categories`", "name": "`--trace-event-categories`", "meta": { "added": [ "v7.7.0" ], "changes": [] }, "desc": "A comma separated list of categories that should be traced when trace event\ntracing is enabled using --trace-events-enabled
.
Template string specifying the filepath for the trace event data, it\nsupports ${rotation}
and ${pid}
.
Enables the collection of trace event tracing information.
", "type": "module", "displayName": "`--trace-events-enabled`" }, { "textRaw": "`--trace-exit`", "name": "`--trace-exit`", "meta": { "added": [ "v13.5.0", "v12.16.0" ], "changes": [] }, "desc": "Prints a stack trace whenever an environment is exited proactively,\ni.e. invoking process.exit()
.
Prints a stack trace on SIGINT.
", "type": "module", "displayName": "`--trace-sigint`" }, { "textRaw": "`--trace-sync-io`", "name": "`--trace-sync-io`", "meta": { "added": [ "v2.1.0" ], "changes": [] }, "desc": "Prints a stack trace whenever synchronous I/O is detected after the first turn\nof the event loop.
", "type": "module", "displayName": "`--trace-sync-io`" }, { "textRaw": "`--trace-tls`", "name": "`--trace-tls`", "meta": { "added": [ "v12.2.0" ], "changes": [] }, "desc": "Prints TLS packet trace information to stderr
. This can be used to debug TLS\nconnection problems.
Print stack traces for uncaught exceptions; usually, the stack trace associated\nwith the creation of an Error
is printed, whereas this makes Node.js also\nprint the stack trace associated with throwing the value (which does not need\nto be an Error
instance).
Enabling this option may affect garbage collection behavior negatively.
", "type": "module", "displayName": "`--trace-uncaught`" }, { "textRaw": "`--trace-warnings`", "name": "`--trace-warnings`", "meta": { "added": [ "v6.0.0" ], "changes": [] }, "desc": "Print stack traces for process warnings (including deprecations).
", "type": "module", "displayName": "`--trace-warnings`" }, { "textRaw": "`--track-heap-objects`", "name": "`--track-heap-objects`", "meta": { "added": [ "v2.4.0" ], "changes": [] }, "desc": "Track heap object allocations for heap snapshots.
", "type": "module", "displayName": "`--track-heap-objects`" }, { "textRaw": "`--unhandled-rejections=mode`", "name": "`--unhandled-rejections=mode`", "meta": { "added": [ "v12.0.0", "v10.17.0" ], "changes": [ { "version": "v15.0.0", "pr-url": "https://github.com/nodejs/node/pull/33021", "description": "Changed default mode to `throw`. Previously, a warning was emitted." } ] }, "desc": "Using this flag allows to change what should happen when an unhandled rejection\noccurs. One of the following modes can be chosen:
\nthrow
: Emit unhandledRejection
. If this hook is not set, raise the\nunhandled rejection as an uncaught exception. This is the default.strict
: Raise the unhandled rejection as an uncaught exception. If the\nexception is handled, unhandledRejection
is emitted.warn
: Always trigger a warning, no matter if the unhandledRejection
\nhook is set or not but do not print the deprecation warning.warn-with-error-code
: Emit unhandledRejection
. If this hook is not\nset, trigger a warning, and set the process exit code to 1.none
: Silence all warnings.If a rejection happens during the command line entry point's ES module static\nloading phase, it will always raise it as an uncaught exception.
", "type": "module", "displayName": "`--unhandled-rejections=mode`" }, { "textRaw": "`--use-bundled-ca`, `--use-openssl-ca`", "name": "`--use-bundled-ca`,_`--use-openssl-ca`", "meta": { "added": [ "v6.11.0" ], "changes": [] }, "desc": "Use bundled Mozilla CA store as supplied by current Node.js version\nor use OpenSSL's default CA store. The default store is selectable\nat build-time.
\nThe bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store\nthat is fixed at release time. It is identical on all supported platforms.
\nUsing 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\nenvironment variables.
\nSee SSL_CERT_DIR
and SSL_CERT_FILE
.
Re-map the Node.js static code to large memory pages at startup. If supported on\nthe target system, this will cause the Node.js static code to be moved onto 2\nMiB pages instead of 4 KiB pages.
\nThe following values are valid for mode
:
off
: No mapping will be attempted. This is the default.on
: If supported by the OS, mapping will be attempted. Failure to map will\nbe ignored and a message will be printed to standard error.silent
: If supported by the OS, mapping will be attempted. Failure to map\nwill be ignored and will not be reported.Print V8 command-line options.
", "type": "module", "displayName": "`--v8-options`" }, { "textRaw": "`--v8-pool-size=num`", "name": "`--v8-pool-size=num`", "meta": { "added": [ "v5.10.0" ], "changes": [] }, "desc": "Set V8's thread pool size which will be used to allocate background jobs.
\nIf set to 0
then Node.js will choose an appropriate size of the thread pool\nbased on an estimate of the amount of parallelism.
The amount of parallelism refers to the number of computations that can be\ncarried out simultaneously in a given machine. In general, it's the same as the\namount of CPUs, but it may diverge in environments such as VMs or containers.
", "type": "module", "displayName": "`--v8-pool-size=num`" }, { "textRaw": "`--watch`", "name": "`--watch`", "meta": { "added": [ "v18.11.0" ], "changes": [ { "version": "v18.13.0", "pr-url": "https://github.com/nodejs/node/pull/45214", "description": "Test runner now supports running in watch mode." } ] }, "stability": 1, "stabilityText": "Experimental", "desc": "Starts Node.js in watch mode.\nWhen in watch mode, changes in the watched files cause the Node.js process to\nrestart.\nBy default, watch mode will watch the entry point\nand any required or imported module.\nUse --watch-path
to specify what paths to watch.
This flag cannot be combined with\n--check
, --eval
, --interactive
, or the REPL.
$ node --watch index.js\n
",
"type": "module",
"displayName": "`--watch`"
},
{
"textRaw": "`--watch-path`",
"name": "`--watch-path`",
"meta": {
"added": [
"v18.11.0"
],
"changes": []
},
"stability": 1,
"stabilityText": "Experimental",
"desc": "Starts Node.js in watch mode and specifies what paths to watch.\nWhen in watch mode, changes in the watched paths cause the Node.js process to\nrestart.\nThis will turn off watching of required or imported modules, even when used in\ncombination with --watch
.
This flag cannot be combined with\n--check
, --eval
, --interactive
, --test
, or the REPL.
$ node --watch-path=./src --watch-path=./tests index.js\n
\nThis option is only supported on macOS and Windows.\nAn ERR_FEATURE_UNAVAILABLE_ON_PLATFORM
exception will be thrown\nwhen the option is used on a platform that does not support it.
Disable the clearing of the console when watch mode restarts the process.
\n$ node --watch --watch-preserve-output test.js\n
",
"type": "module",
"displayName": "`--watch-preserve-output`"
},
{
"textRaw": "`--zero-fill-buffers`",
"name": "`--zero-fill-buffers`",
"meta": {
"added": [
"v6.0.0"
],
"changes": []
},
"desc": "Automatically zero-fills all newly allocated Buffer
and SlowBuffer
\ninstances.
Syntax check the script without executing.
", "type": "module", "displayName": "`-c`, `--check`" }, { "textRaw": "`-e`, `--eval \"script\"`", "name": "`-e`,_`--eval_\"script\"`", "meta": { "added": [ "v0.5.2" ], "changes": [ { "version": "v5.11.0", "pr-url": "https://github.com/nodejs/node/pull/5348", "description": "Built-in libraries are now available as predefined variables." } ] }, "desc": "Evaluate the following argument as JavaScript. The modules which are\npredefined in the REPL can also be used in script
.
On Windows, using cmd.exe
a single quote will not work correctly because it\nonly recognizes double \"
for quoting. In Powershell or Git bash, both '
\nand \"
are usable.
Print node command-line options.\nThe output of this option is less detailed than this document.
", "type": "module", "displayName": "`-h`, `--help`" }, { "textRaw": "`-i`, `--interactive`", "name": "`-i`,_`--interactive`", "meta": { "added": [ "v0.7.7" ], "changes": [] }, "desc": "Opens the REPL even if stdin does not appear to be a terminal.
", "type": "module", "displayName": "`-i`, `--interactive`" }, { "textRaw": "`-p`, `--print \"script\"`", "name": "`-p`,_`--print_\"script\"`", "meta": { "added": [ "v0.6.4" ], "changes": [ { "version": "v5.11.0", "pr-url": "https://github.com/nodejs/node/pull/5348", "description": "Built-in libraries are now available as predefined variables." } ] }, "desc": "Identical to -e
but prints the result.
Preload the specified module at startup.
\nFollows require()
's module resolution\nrules. module
may be either a path to a file, or a node module name.
Only CommonJS modules are supported.\nUse --import
to preload an ECMAScript module.\nModules preloaded with --require
will run before modules preloaded with --import
.
Print node's version.
", "type": "module", "displayName": "`-v`, `--version`" } ], "type": "misc", "displayName": "Options" }, { "textRaw": "Environment variables", "name": "environment_variables", "modules": [ { "textRaw": "`FORCE_COLOR=[1, 2, 3]`", "name": "`force_color=[1,_2,_3]`", "desc": "The FORCE_COLOR
environment variable is used to\nenable ANSI colorized output. The value may be:
1
, true
, or the empty string ''
indicate 16-color support,2
to indicate 256-color support, or3
to indicate 16 million-color support.When FORCE_COLOR
is used and set to a supported value, both the NO_COLOR
,\nand NODE_DISABLE_COLORS
environment variables are ignored.
Any other value will result in colorized output being disabled.
", "type": "module", "displayName": "`FORCE_COLOR=[1, 2, 3]`" }, { "textRaw": "`NODE_DEBUG=module[,…]`", "name": "`node_debug=module[,…]`", "meta": { "added": [ "v0.1.32" ], "changes": [] }, "desc": "','
-separated list of core modules that should print debug information.
','
-separated list of core C++ modules that should print debug information.
When set, colors will not be used in the REPL.
", "type": "module", "displayName": "`NODE_DISABLE_COLORS=1`" }, { "textRaw": "`NODE_EXTRA_CA_CERTS=file`", "name": "`node_extra_ca_certs=file`", "meta": { "added": [ "v7.3.0" ], "changes": [] }, "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.
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.
This environment variable is ignored when node
runs as setuid root or\nhas Linux file capabilities set.
The NODE_EXTRA_CA_CERTS
environment variable is only read when the Node.js\nprocess is first launched. Changing the value at runtime using\nprocess.env.NODE_EXTRA_CA_CERTS
has no effect on the current process.
Data path for ICU (Intl
object) data. Will extend linked-in data when compiled\nwith small-icu support.
When set to 1
, process warnings are silenced.
A space-separated list of command-line options. options...
are interpreted\nbefore command-line options, so command-line options will override or\ncompound after anything in options...
. Node.js will exit with an error if\nan option that is not allowed in the environment is used, such as -p
or a\nscript file.
If an option value contains a space, it can be escaped using double quotes:
\nNODE_OPTIONS='--require \"./my path/file.js\"'\n
\nA singleton flag passed as a command-line option will override the same flag\npassed into NODE_OPTIONS
:
# The inspector will be available on port 5555\nNODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555\n
\nA flag that can be passed multiple times will be treated as if its\nNODE_OPTIONS
instances were passed first, and then its command-line\ninstances afterwards:
NODE_OPTIONS='--require \"./a.js\"' node --require \"./b.js\"\n# is equivalent to:\nnode --require \"./a.js\" --require \"./b.js\"\n
\nNode.js options that are allowed are:
\n\n--conditions
, -C
--diagnostic-dir
--disable-proto
--dns-result-order
--enable-fips
--enable-network-family-autoselection
--enable-source-maps
--experimental-abortcontroller
--experimental-default-type
--experimental-global-customevent
--experimental-global-webcrypto
--experimental-import-meta-resolve
--experimental-json-modules
--experimental-loader
--experimental-modules
--experimental-network-imports
--experimental-policy
--experimental-shadow-realm
--experimental-specifier-resolution
--experimental-top-level-await
--experimental-vm-modules
--experimental-wasi-unstable-preview1
--experimental-wasm-modules
--force-context-aware
--force-fips
--force-node-api-uncaught-exceptions-policy
--frozen-intrinsics
--heapsnapshot-near-heap-limit
--heapsnapshot-signal
--http-parser
--icu-data-dir
--import
--input-type
--insecure-http-parser
--inspect-brk
--inspect-port
, --debug-port
--inspect-publish-uid
--inspect
--max-http-header-size
--napi-modules
--no-addons
--no-deprecation
--no-experimental-fetch
--no-experimental-repl-await
--no-extra-info-on-fatal-exception
--no-force-async-hooks-checks
--no-global-search-paths
--no-warnings
--node-memory-debug
--openssl-config
--openssl-legacy-provider
--openssl-shared-config
--pending-deprecation
--policy-integrity
--preserve-symlinks-main
--preserve-symlinks
--prof-process
--redirect-warnings
--report-compact
--report-dir
, --report-directory
--report-filename
--report-on-fatalerror
--report-on-signal
--report-signal
--report-uncaught-exception
--require
, -r
--secure-heap-min
--secure-heap
--snapshot-blob
--test-only
--test-reporter-destination
--test-reporter
--test-shard
--throw-deprecation
--title
--tls-cipher-list
--tls-keylog
--tls-max-v1.2
--tls-max-v1.3
--tls-min-v1.0
--tls-min-v1.1
--tls-min-v1.2
--tls-min-v1.3
--trace-atomics-wait
--trace-deprecation
--trace-event-categories
--trace-event-file-pattern
--trace-events-enabled
--trace-exit
--trace-sigint
--trace-sync-io
--trace-tls
--trace-uncaught
--trace-warnings
--track-heap-objects
--unhandled-rejections
--use-bundled-ca
--use-largepages
--use-openssl-ca
--v8-pool-size
--watch-path
--watch-preserve-output
--watch
--zero-fill-buffers
V8 options that are allowed are:
\n\n--abort-on-uncaught-exception
--disallow-code-generation-from-strings
--enable-etw-stack-walking
--huge-max-old-generation-size
--interpreted-frames-native-stack
--jitless
--max-old-space-size
--max-semi-space-size
--perf-basic-prof-only-functions
--perf-basic-prof
--perf-prof-unwinding-info
--perf-prof
--stack-trace-limit
--perf-basic-prof-only-functions
, --perf-basic-prof
,\n--perf-prof-unwinding-info
, and --perf-prof
are only available on Linux.
--enable-etw-stack-walking
is only available on Windows.
':'
-separated list of directories prefixed to the module search path.
On Windows, this is a ';'
-separated list instead.
When set to 1
, emit pending deprecation warnings.
Pending deprecations are generally identical to a runtime deprecation with the\nnotable exception that they are turned off by default and will not be emitted\nunless either the --pending-deprecation
command-line flag, or the\nNODE_PENDING_DEPRECATION=1
environment variable, is set. Pending deprecations\nare used to provide a kind of selective \"early warning\" mechanism that\ndevelopers may leverage to detect deprecated API usage.
Set the number of pending pipe instance handles when the pipe server is waiting\nfor connections. This setting applies to Windows only.
", "type": "module", "displayName": "`NODE_PENDING_PIPE_INSTANCES=instances`" }, { "textRaw": "`NODE_PRESERVE_SYMLINKS=1`", "name": "`node_preserve_symlinks=1`", "meta": { "added": [ "v7.1.0" ], "changes": [] }, "desc": "When set to 1
, instructs the module loader to preserve symbolic links when\nresolving and caching modules.
When set, process warnings will be emitted to the given file instead of\nprinting to stderr. The file will be created if it does not exist, and will be\nappended to if it does. If an error occurs while attempting to write the\nwarning to the file, the warning will be written to stderr instead. This is\nequivalent to using the --redirect-warnings=file
command-line flag.
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.
Path to a Node.js module which will be loaded in place of the built-in REPL.\nOverriding this value to an empty string (''
) will use the built-in REPL.
If value
equals '1'
, the check for a supported platform is skipped during\nNode.js startup. Node.js might not execute correctly. Any issues encountered\non unsupported platforms will not be fixed.
If value
equals 'child'
, test reporter options will be overridden and test\noutput will be sent to stdout in the TAP format. If any other value is provided,\nNode.js makes no guarantees about the reporter format used or its stability.
If value
equals '0'
, certificate validation is disabled for TLS connections.\nThis makes TLS, and HTTPS by extension, insecure. The use of this environment\nvariable is strongly discouraged.
When set, Node.js will begin outputting V8 JavaScript code coverage and\nSource Map data to the directory provided as an argument (coverage\ninformation is written as JSON to files with a coverage
prefix).
NODE_V8_COVERAGE
will automatically propagate to subprocesses, making it\neasier to instrument applications that call the child_process.spawn()
family\nof functions. NODE_V8_COVERAGE
can be set to an empty string, to prevent\npropagation.
Coverage is output as an array of ScriptCoverage objects on the top-level\nkey result
:
{\n \"result\": [\n {\n \"scriptId\": \"67\",\n \"url\": \"internal/tty.js\",\n \"functions\": []\n }\n ]\n}\n
",
"type": "module",
"displayName": "Coverage output"
},
{
"textRaw": "Source map cache",
"name": "source_map_cache",
"stability": 1,
"stabilityText": "Experimental",
"desc": "If found, source map data is appended to the top-level key source-map-cache
\non the JSON coverage object.
source-map-cache
is an object with keys representing the files source maps\nwere extracted from, and values which include the raw source-map URL\n(in the key url
), the parsed Source Map v3 information (in the key data
),\nand the line lengths of the source file (in the key lineLengths
).
{\n \"result\": [\n {\n \"scriptId\": \"68\",\n \"url\": \"file:///absolute/path/to/source.js\",\n \"functions\": []\n }\n ],\n \"source-map-cache\": {\n \"file:///absolute/path/to/source.js\": {\n \"url\": \"./path-to-map.json\",\n \"data\": {\n \"version\": 3,\n \"sources\": [\n \"file:///absolute/path/to/original.js\"\n ],\n \"names\": [\n \"Foo\",\n \"console\",\n \"info\"\n ],\n \"mappings\": \"MAAMA,IACJC,YAAaC\",\n \"sourceRoot\": \"./\"\n },\n \"lineLengths\": [\n 13,\n 62,\n 38,\n 27\n ]\n }\n }\n}\n
",
"type": "module",
"displayName": "Source map cache"
}
],
"type": "module",
"displayName": "`NODE_V8_COVERAGE=dir`"
},
{
"textRaw": "`NO_COLOR=NO_COLOR
is an alias for NODE_DISABLE_COLORS
. The value of the\nenvironment variable is arbitrary.
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
.
If the --openssl-config
command-line option is used, the environment\nvariable is ignored.
If --use-openssl-ca
is enabled, this overrides and sets OpenSSL's directory\ncontaining trusted certificates.
Be aware that unless the child environment is explicitly set, this environment\nvariable will be inherited by any child processes, and if they use OpenSSL, it\nmay cause them to trust the same CAs as node.
", "type": "module", "displayName": "`SSL_CERT_DIR=dir`" }, { "textRaw": "`SSL_CERT_FILE=file`", "name": "`ssl_cert_file=file`", "meta": { "added": [ "v7.7.0" ], "changes": [] }, "desc": "If --use-openssl-ca
is enabled, this overrides and sets OpenSSL's file\ncontaining trusted certificates.
Be aware that unless the child environment is explicitly set, this environment\nvariable will be inherited by any child processes, and if they use OpenSSL, it\nmay cause them to trust the same CAs as node.
", "type": "module", "displayName": "`SSL_CERT_FILE=file`" }, { "textRaw": "`TZ`", "name": "`tz`", "meta": { "added": [ "v0.0.1" ], "changes": [ { "version": [ "v16.2.0" ], "pr-url": "https://github.com/nodejs/node/pull/38642", "description": "Changing the TZ variable using process.env.TZ = changes the timezone on Windows as well." }, { "version": [ "v13.0.0" ], "pr-url": "https://github.com/nodejs/node/pull/20026", "description": "Changing the TZ variable using process.env.TZ = changes the timezone on POSIX systems." } ] }, "desc": "The TZ
environment variable is used to specify the timezone configuration.
While Node.js does not support all of the various ways that TZ
is handled in\nother environments, it does support basic timezone IDs (such as\n'Etc/UTC'
, 'Europe/Paris'
, or 'America/New_York'
).\nIt may support a few other abbreviations or aliases, but these are strongly\ndiscouraged and not guaranteed.
$ TZ=Europe/Dublin node -pe \"new Date().toString()\"\nWed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)\n
",
"type": "module",
"displayName": "`TZ`"
},
{
"textRaw": "`UV_THREADPOOL_SIZE=size`",
"name": "`uv_threadpool_size=size`",
"desc": "Set the number of threads used in libuv's threadpool to size
threads.
Asynchronous system APIs are used by Node.js whenever possible, but where they\ndo not exist, libuv's threadpool is used to create asynchronous node APIs based\non synchronous system APIs. Node.js APIs that use the threadpool are:
\nfs
APIs, other than the file watcher APIs and those that are explicitly\nsynchronouscrypto.pbkdf2()
, crypto.scrypt()
,\ncrypto.randomBytes()
, crypto.randomFill()
, crypto.generateKeyPair()
dns.lookup()
zlib
APIs, other than those that are explicitly synchronousBecause libuv's threadpool has a fixed size, it means that if for whatever\nreason any of these APIs takes a long time, other (seemingly unrelated) APIs\nthat run in libuv's threadpool will experience degraded performance. In order to\nmitigate this issue, one potential solution is to increase the size of libuv's\nthreadpool by setting the 'UV_THREADPOOL_SIZE'
environment variable to a value\ngreater than 4
(its current default value). For more information, see the\nlibuv threadpool documentation.
V8 has its own set of CLI options. Any V8 CLI option that is provided to node
\nwill be passed on to V8 to handle. V8's options have no stability guarantee.\nThe V8 team themselves don't consider them to be part of their formal API,\nand reserve the right to change them at any time. Likewise, they are not\ncovered by the Node.js stability guarantees. Many of the V8\noptions are of interest only to V8 developers. Despite this, there is a small\nset of V8 options that are widely applicable to Node.js, and they are\ndocumented here:
Sets the max memory size of V8's old memory section. As memory\nconsumption approaches the limit, V8 will spend more time on\ngarbage collection in an effort to free unused memory.
\nOn a machine with 2 GiB of memory, consider setting this to\n1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.
\n$ node --max-old-space-size=1536 index.js\n
",
"type": "module",
"displayName": "`--max-old-space-size=SIZE` (in megabytes)"
},
{
"textRaw": "`--max-semi-space-size=SIZE` (in megabytes)",
"name": "`--max-semi-space-size=size`_(in_megabytes)",
"desc": "Sets the maximum semi-space size for V8's scavenge garbage collector in\nMiB (megabytes).\nIncreasing the max size of a semi-space may improve throughput for Node.js at\nthe cost of more memory consumption.
\nSince the young generation size of the V8 heap is three times (see\nYoungGenerationSizeFromSemiSpaceSize
in V8) the size of the semi-space,\nan increase of 1 MiB to semi-space applies to each of the three individual\nsemi-spaces and causes the heap size to increase by 3 MiB. The throughput\nimprovement depends on your workload (see #42511).
The default value is 16 MiB for 64-bit systems and 8 MiB for 32-bit systems. To\nget the best configuration for your application, you should try different\nmax-semi-space-size values when running benchmarks for your application.
\nFor example, benchmark on a 64-bit systems:
\nfor MiB in 16 32 64 128; do\n node --max-semi-space-size=$MiB index.js\ndone\n
",
"type": "module",
"displayName": "`--max-semi-space-size=SIZE` (in megabytes)"
}
],
"type": "misc",
"displayName": "Useful V8 options"
}
]
}
]
}