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.
To view this documentation as a manual page in a terminal, run man node.
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.
For more info about node inspect, see the debugger documentation.
node inspect
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. If no\ncorresponding file is found, an error is thrown.
If a file is found, its path will be passed to the ECMAScript module loader\nunder any of the following conditions:
.mjs
.cjs
package.json
\"type\"
\"module\"
Otherwise, the file is loaded using the CommonJS module loader. See\nModules loaders for more details.
When loading ECMAScript module loader loads the program entry point, the node\ncommand will only accept as input only files with .js, .mjs, or .cjs\nextensions; and with .wasm extensions when\n--experimental-wasm-modules is enabled.
node
.js
.wasm
--experimental-wasm-modules
All options, including V8 options, allow words to be separated by both\ndashes (-) or underscores (_). For example, --pending-deprecation is\nequivalent to --pending_deprecation.
-
_
--pending-deprecation
--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.
--max-http-header-size
NODE_OPTIONS
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.
Aborting instead of exiting causes a core file to be generated for post-mortem\nanalysis using a debugger (such as lldb, gdb, and mdb).
lldb
gdb
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).
process.setUncaughtExceptionCaptureCallback()
node:domain
Print source-able bash completion script for Node.js.
$ node --completion-bash > node_bash_completion\n$ source node_bash_completion\n
Enable experimental support for custom conditional exports resolution\nconditions.
Any number of custom string condition names are permitted.
The default Node.js conditions of \"node\", \"default\", \"import\", and\n\"require\" will always apply as defined.
\"node\"
\"default\"
\"import\"
\"require\"
For example, to run a module with \"development\" resolutions:
$ node -C=development app.js\n
Starts the V8 CPU profiler on start up, and writes the CPU profile to disk\nbefore exit.
If --cpu-prof-dir is not specified, the generated profile is placed\nin the current working directory.
--cpu-prof-dir
If --cpu-prof-name is not specified, the generated profile is\nnamed CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile.
--cpu-prof-name
CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile
$ node --cpu-prof index.js\n$ ls *.cpuprofile\nCPU.20190409.202950.15293.0.0.cpuprofile\n
Specify the directory where the CPU profiles generated by --cpu-prof will\nbe placed.
--cpu-prof
The default value is controlled by the\n--diagnostic-dir command-line option.
--diagnostic-dir
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.
Affects the default output directory of:
--heap-prof-dir
--redirect-warnings
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.
Object.prototype.__proto__
mode
delete
throw
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.
eval
new Function
node:vm
Set the default value of verbatim in dns.lookup() and\ndnsPromises.lookup(). The value could be:
verbatim
dns.lookup()
dnsPromises.lookup()
ipv4first
false
true
The default is ipv4first and dns.setDefaultResultOrder() have higher\npriority than --dns-result-order.
dns.setDefaultResultOrder()
--dns-result-order
Enable FIPS-compliant crypto at startup. (Requires Node.js to be built\nagainst FIPS-compatible OpenSSL.)
Enable Source Map v3 support for stack traces.
When 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.
--enable-source-maps
Overriding Error.prepareStackTrace prevents --enable-source-maps from\nmodifying the stack trace.
Error.prepareStackTrace
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.
Error.stack
Enable experimental support for the Fetch API.
Expose the CustomEvent Web API on the global scope.
Expose the Web Crypto API on the global scope.
Enable experimental import.meta.resolve() support.
import.meta.resolve()
Specify the module of a custom experimental ECMAScript module loader.\nmodule may be any string accepted as an import specifier.
module
import
Enable experimental support for the https: protocol in import specifiers.
https:
Use the specified file as a security policy.
Use this flag to disable top-level await in REPL.
Sets the resolution algorithm for resolving ES module specifiers. Valid options\nare explicit and node.
explicit
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.
Enable experimental ES Module support in the node:vm module.
Enable experimental WebAssembly System Interface (WASI) support.
Enable experimental WebAssembly module support.
Disable loading native addons that are not context-aware.
Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)\n(Same requirements as --enable-fips.)
--enable-fips
Enable experimental frozen intrinsics like Array and Object.
Array
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.
globalThis.Array
To allow polyfills to be added, --require runs before freezing intrinsics.
--require
Enforces uncaughtException event on Node-API asynchronous callbacks.
uncaughtException
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.
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).
count
max_count
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.
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.
$ 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
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.
signal
$ 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
Starts the V8 heap profiler on start up, and writes the heap profile to disk\nbefore exit.
If --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.
--heap-prof-name
Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile
$ node --heap-prof index.js\n$ ls *.heapprofile\nHeap.20190409.202950.15293.0.001.heapprofile\n
Specify the directory where the heap profiles generated by --heap-prof will\nbe placed.
--heap-prof
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.)
NODE_ICU_DATA
This configures Node.js to interpret string input as CommonJS or as an ES\nmodule. String input is input via --eval, --print, or STDIN.
--eval
--print
STDIN
Valid values are \"commonjs\" and \"module\". The default is \"commonjs\".
\"commonjs\"
The REPL does not support this option.
Activate inspector on host:port and break at start of user script.\nDefault host:port is 127.0.0.1:9229.
host:port
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.
SIGUSR1
Default host is 127.0.0.1.
127.0.0.1
See the security warning below regarding the host\nparameter usage.
host
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.
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.
0.0.0.0
If specifying a host, make sure that either:
More specifically, --inspect=0.0.0.0 is insecure if the port (9229 by\ndefault) is not firewall-protected.
--inspect=0.0.0.0
9229
See the debugging security implications section for more information.
Specify ways of the inspector web socket url exposure.
By default inspector websocket url is available in stderr and under /json/list\nendpoint on http://host:port/json/list.
/json/list
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.
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.
This flag is inherited from V8 and is subject to change upstream. It may\ndisappear in a non-semver-major release.
Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.
This option is a no-op. It is kept for compatibility.
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.
node-addons
--no-addons
process.dlopen
Silence deprecation warnings.
Disables runtime checks for async_hooks. These will still be enabled\ndynamically when async_hooks is enabled.
async_hooks
Do not search modules from global paths like $HOME/.node_modules and\n$NODE_PATH.
$HOME/.node_modules
$NODE_PATH
Silence all process warnings (including deprecations).
Enable extra debug checks for memory leaks in Node.js internals. This is\nusually only useful for developers debugging Node.js itself.
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.
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.
openssl_conf
openssl.cnf
OPENSSL_CONF
--openssl-config
nodejs_conf
Enable OpenSSL 3.0 legacy provider when dynamically linking to OpenSSL 3.x.\nFor more information please see OSSL_PROVIDER-legacy.
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.
NODE_PENDING_DEPRECATION=1
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.
Instructs the module loader to preserve symbolic links when resolving and\ncaching modules.
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:
moduleA
moduleB
{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
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.
--preserve-symlinks
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.
node --preserve-symlinks node_module/.bin/<foo>
--preserve-symlinks-main
Instructs the module loader to preserve symbolic links when resolving and\ncaching the main module (require.main).
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.
Process V8 profiler output generated using the V8 option --prof.
--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.
The 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.
file
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.
Location at which the report will be generated.
Name of the file to which the report will be written.
If the filename is set to 'stdout' or 'stderr', the report is written to\nthe stdout or stderr of the process respectively.
'stdout'
'stderr'
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.
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.
--report-signal
Sets or resets the signal for report generation (not supported on Windows).\nDefault signal is SIGUSR2.
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.
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.
n
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.
The heap size given must be a power of two. Any value less than 2\nwill disable the secure heap.
The secure heap is disabled by default.
The secure heap is not available on Windows.
See CRYPTO_secure_malloc_init for more details.
CRYPTO_secure_malloc_init
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.
--secure-heap
--secure-heap-min
2
2147483647
Starts the Node.js command line test runner. This flag cannot be combined with\n--check, --eval, --interactive, or the inspector. See the documentation\non running tests from the command line for more details.
--check
--interactive
Configures the test runner to only execute top level tests that have the only\noption set.
only
Throw errors for deprecations.
Set process.title on startup.
process.title
Specify an alternative default TLS cipher list. Requires Node.js to be built\nwith crypto support (default).
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.
SSLKEYLOGFILE
Set tls.DEFAULT_MAX_VERSION to 'TLSv1.2'. Use to disable support for\nTLSv1.3.
tls.DEFAULT_MAX_VERSION
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.
tls.DEFAULT_MIN_VERSION
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:
Atomics.wait()
(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
The fields here correspond to:
worker_threads.threadId
SharedArrayBuffer
Atomics.wait
Print stack traces for deprecations.
A comma separated list of categories that should be traced when trace event\ntracing is enabled using --trace-events-enabled.
--trace-events-enabled
Template string specifying the filepath for the trace event data, it\nsupports ${rotation} and ${pid}.
${rotation}
${pid}
Enables the collection of trace event tracing information.
Prints a stack trace whenever an environment is exited proactively,\ni.e. invoking process.exit().
process.exit()
Prints a stack trace on SIGINT.
Prints a stack trace whenever synchronous I/O is detected after the first turn\nof the event loop.
Prints TLS packet trace information to stderr. This can be used to debug TLS\nconnection problems.
stderr
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).
Error
Enabling this option may affect garbage collection behavior negatively.
Print stack traces for process warnings (including deprecations).
Track heap object allocations for heap snapshots.
Using this flag allows to change what should happen when an unhandled rejection\noccurs. One of the following modes can be chosen:
unhandledRejection
strict
warn
warn-with-error-code
none
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.
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.
The 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.
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\nenvironment variables.
See SSL_CERT_DIR and SSL_CERT_FILE.
SSL_CERT_DIR
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.
The following values are valid for mode:
off
on
silent
Print V8 command-line options.
Set V8's thread pool size which will be used to allocate background jobs.
If set to 0 then V8 will choose an appropriate size of the thread pool based\non the number of online processors.
If the value provided is larger than V8's maximum, then the largest value\nwill be chosen.
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.
--watch-path
This flag cannot be combined with\n--check, --eval, --interactive, or the REPL.
$ node --watch index.js\n
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.
--watch
$ node --watch-path=./src --watch-path=./tests index.js\n
This 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.
ERR_FEATURE_UNAVAILABLE_ON_PLATFORM
Automatically zero-fills all newly allocated Buffer and SlowBuffer\ninstances.
Buffer
SlowBuffer
Syntax check the script without executing.
Evaluate the following argument as JavaScript. The modules which are\npredefined in the REPL can also be used in script.
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.
cmd.exe
\"
'
Print node command-line options.\nThe output of this option is less detailed than this document.
Opens the REPL even if stdin does not appear to be a terminal.
Identical to -e but prints the result.
-e
Preload the specified module at startup.
Follows require()'s module resolution\nrules. module may be either a path to a file, or a node module name.
require()
Only CommonJS modules are supported. Attempting to preload a\nES6 Module using --require will fail with an error.
Print node's version.
The FORCE_COLOR environment variable is used to\nenable ANSI colorized output. The value may be:
FORCE_COLOR
1
''
3
When FORCE_COLOR is used and set to a supported value, both the NO_COLOR,\nand NODE_DISABLE_COLORS environment variables are ignored.
NO_COLOR
NODE_DISABLE_COLORS
Any other value will result in colorized output being disabled.
','-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.
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.
process.emitWarning()
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.
ca
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.
NODE_EXTRA_CA_CERTS
process.env.NODE_EXTRA_CA_CERTS
Data path for ICU (Intl object) data. Will extend linked-in data when compiled\nwith small-icu support.
Intl
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.
options...
-p
If an option value contains a space, it can be escaped using double quotes:
NODE_OPTIONS='--require \"./my path/file.js\"'\n
A 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
A 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
Node.js options that are allowed are:
--conditions
-C
--disable-proto
--experimental-abortcontroller
--experimental-fetch
--experimental-global-customevent
--experimental-global-webcrypto
--experimental-import-meta-resolve
--experimental-json-modules
--experimental-loader
--experimental-modules
--experimental-network-imports
--experimental-policy
--experimental-specifier-resolution
--experimental-top-level-await
--experimental-vm-modules
--experimental-wasi-unstable-preview1
--force-context-aware
--force-fips
--force-node-api-uncaught-exceptions-policy
--frozen-intrinsics
--heapsnapshot-near-heap-limit
--heapsnapshot-signal
--http-parser
--icu-data-dir
--input-type
--insecure-http-parser
--inspect-brk
--inspect-port
--debug-port
--inspect-publish-uid
--inspect
--napi-modules
--no-deprecation
--no-experimental-repl-await
--no-force-async-hooks-checks
--no-global-search-paths
--no-warnings
--node-memory-debug
--openssl-legacy-provider
--openssl-shared-config
--policy-integrity
--prof-process
--report-compact
--report-dir
--report-directory
--report-filename
--report-on-fatalerror
--report-on-signal
--report-uncaught-exception
-r
--test-only
--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-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
--zero-fill-buffers
V8 options that are allowed are:
--abort-on-uncaught-exception
--disallow-code-generation-from-strings
--huge-max-old-generation-size
--interpreted-frames-native-stack
--jitless
--max-old-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.
':'-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.
Set the number of pending pipe instance handles when the pipe server is waiting\nfor connections. This setting applies to Windows only.
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.
--redirect-warnings=file
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.
~/.node_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.
value
'1'
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.
'0'
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).
coverage
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.
NODE_V8_COVERAGE
child_process.spawn()
Coverage is output as an array of ScriptCoverage objects on the top-level\nkey result:
result
{\n \"result\": [\n {\n \"scriptId\": \"67\",\n \"url\": \"internal/tty.js\",\n \"functions\": []\n }\n ]\n}\n
If found, source map data is appended to the top-level key source-map-cache\non the JSON coverage object.
source-map-cache
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).
url
data
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
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.
./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.
If --use-openssl-ca is enabled, this overrides and sets OpenSSL's file\ncontaining trusted certificates.
The TZ environment variable is used to specify the timezone configuration.
TZ
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.
'Etc/UTC'
'Europe/Paris'
'America/New_York'
$ TZ=Europe/Dublin node -pe \"new Date().toString()\"\nWed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)\n
Set the number of threads used in libuv's threadpool to size threads.
size
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:
fs
crypto.pbkdf2()
crypto.scrypt()
crypto.randomBytes()
crypto.randomFill()
crypto.generateKeyPair()
zlib
Because 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.
'UV_THREADPOOL_SIZE'
4
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.
On 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.
$ node --max-old-space-size=1536 index.js\n
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.
Since 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).
YoungGenerationSizeFromSemiSpaceSize
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.
For example, benchmark on a 64-bit systems:
for MiB in 16 32 64 128; do\n node --max-semi-space-size=$MiB index.js\ndone\n