{ "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.
\n
To view this documentation as a manual page in a terminal, run man node.
", "miscs": [ { "textRaw": "Synopsis", "name": "synopsis", "type": "misc", "desc": "
node [options] [V8 options] [<program-entry-point> | -e \"script\" | -] [--] [arguments]
\n
node inspect [<program-entry-point> | -e \"script\" | <host>:<port>] â¦
\n
node --v8-options
\n
Execute without arguments to start the REPL.
\n
For more info about node inspect, see the debugger documentation.
", "displayName": "Synopsis" }, { "textRaw": "Program entry point", "name": "program_entry_point", "type": "misc", "desc": "
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 entry point string is then resolved as if it's been requested\nby require() from the current working directory. If no corresponding file\nis found, an error is thrown.
\n
By default, the resolved path is also loaded as if it's been requested by require(),\nunless one of the conditions below applyâthen it's loaded as if it's been requested\nby import():
\n
--import..mjs, .mts or .wasm extension..cjs extension, and the nearest parent\npackage.json file contains a top-level \"type\" field with a value of\n\"module\".\n
See module resolution and loading for more details.
", "displayName": "Program entry point" }, { "textRaw": "Options", "name": "options", "type": "misc", "meta": { "changes": [ { "version": "v10.12.0", "pr-url": "https://github.com/nodejs/node/pull/23020", "description": "Underscores instead of dashes are now allowed for Node.js options as well, in addition to V8 options." } ] }, "stability": 2, "stabilityText": "Stable", "desc": "
All options, including V8 options, allow words to be separated by both\ndashes (-) or underscores (_). For example, --pending-deprecation is\nequivalent to --pending_deprecation.
\n
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.
", "modules": [ { "textRaw": "`-`", "name": "`-`", "type": "module", "meta": { "added": [ "v8.0.0" ], "changes": [] }, "desc": "
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.
", "displayName": "`-`" }, { "textRaw": "`--`", "name": "`--`", "type": "module", "meta": { "added": [ "v6.11.0" ], "changes": [] }, "desc": "
Indicate the end of node options. Pass the rest of the arguments to the script.\nIf no script filename or eval/print script is supplied prior to this, then\nthe next argument is used as a script filename.
", "displayName": "`--`" }, { "textRaw": "`--abort-on-uncaught-exception`", "name": "`--abort-on-uncaught-exception`", "type": "module", "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).
\n
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).
", "displayName": "`--abort-on-uncaught-exception`" }, { "textRaw": "`--allow-addons`", "name": "`--allow-addons`", "type": "module", "meta": { "added": [ "v21.6.0", "v20.12.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be able to use\nnative addons by default.\nAttempts to do so will throw an ERR_DLOPEN_DISABLED unless the\nuser explicitly passes the --allow-addons flag when starting Node.js.
\n
Example:
\n
// Attempt to require an native addon\nrequire('nodejs-addon-example');\n\n
$ node --permission --allow-fs-read=* index.js\nnode:internal/modules/cjs/loader:1319\n return process.dlopen(module, path.toNamespacedPath(filename));\n ^\n\nError: Cannot load native addon because loading addons is disabled.\n at Module._extensions..node (node:internal/modules/cjs/loader:1319:18)\n at Module.load (node:internal/modules/cjs/loader:1091:32)\n at Module._load (node:internal/modules/cjs/loader:938:12)\n at Module.require (node:internal/modules/cjs/loader:1115:19)\n at require (node:internal/modules/helpers:130:18)\n at Object.<anonymous> (/home/index.js:1:15)\n at Module._compile (node:internal/modules/cjs/loader:1233:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)\n at Module.load (node:internal/modules/cjs/loader:1091:32)\n at Module._load (node:internal/modules/cjs/loader:938:12) {\n code: 'ERR_DLOPEN_DISABLED'\n}\n", "displayName": "`--allow-addons`" }, { "textRaw": "`--allow-child-process`", "name": "`--allow-child-process`", "type": "module", "meta": { "added": [ "v20.0.0" ], "changes": [ { "version": [ "v24.4.0", "v22.18.0" ], "pr-url": "https://github.com/nodejs/node/pull/58853", "description": "When spawning process with the permission model enabled. The flags are inherit to the child Node.js process through NODE_OPTIONS environment variable." } ] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be able to spawn any\nchild process by default.\nAttempts to do so will throw an ERR_ACCESS_DENIED unless the\nuser explicitly passes the --allow-child-process flag when starting Node.js.
\n
Example:
\n
const childProcess = require('node:child_process');\n// Attempt to bypass the permission\nchildProcess.spawn('node', ['-e', 'require(\"fs\").writeFileSync(\"/new-file\", \"example\")']);\n\n
$ node --permission --allow-fs-read=* index.js\nnode:internal/child_process:388\n const err = this._handle.spawn(options);\n ^\nError: Access to this API has been restricted\n at ChildProcess.spawn (node:internal/child_process:388:28)\n at node:internal/main/run_main_module:17:47 {\n code: 'ERR_ACCESS_DENIED',\n permission: 'ChildProcess'\n}\n\n
The child_process.fork() API inherits the execution arguments from the\nparent process. This means that if Node.js is started with the Permission\nModel enabled and the --allow-child-process flag is set, any child process\ncreated using child_process.fork() will automatically receive all relevant\nPermission Model flags.
\n
This behavior also applies to child_process.spawn(), but in that case, the\nflags are propagated via the NODE_OPTIONS environment variable rather than\ndirectly through the process arguments.
", "displayName": "`--allow-child-process`" }, { "textRaw": "`--allow-ffi`", "name": "`--allow-ffi`", "type": "module", "meta": { "added": [ "v26.1.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be able to use FFI\nAPIs by default. Attempts to use FFI APIs will throw an ERR_ACCESS_DENIED\nexception unless the user explicitly passes the --allow-ffi flag when\nstarting Node.js. The node:ffi module also requires the\n--experimental-ffi flag and is only available in builds with FFI support.
\n
Example:
\n
const { DynamicLibrary } = require('node:ffi');\nconst lib = new DynamicLibrary('mylib.so');\n\n
$ node --permission --experimental-ffi index.js\nError: Access to this API has been restricted. Use --allow-ffi to manage permissions.\n at node:internal/main/run_main_module:17:47 {\n code: 'ERR_ACCESS_DENIED',\n permission: 'FFI'\n}\n", "displayName": "`--allow-ffi`" }, { "textRaw": "`--allow-fs-read`", "name": "`--allow-fs-read`", "type": "module", "meta": { "added": [ "v20.0.0" ], "changes": [ { "version": [ "v24.2.0", "v22.17.0" ], "pr-url": "https://github.com/nodejs/node/pull/58579", "description": "Entrypoints of your application are allowed to be read implicitly." }, { "version": [ "v23.5.0", "v22.13.0" ], "pr-url": "https://github.com/nodejs/node/pull/56201", "description": "Permission Model and --allow-fs flags are stable." }, { "version": "v20.7.0", "pr-url": "https://github.com/nodejs/node/pull/49047", "description": "Paths delimited by comma (`,`) are no longer allowed." } ] }, "desc": "
This flag configures file system read permissions using\nthe Permission Model.
\n
The valid arguments for the --allow-fs-read flag are:
\n
* - To allow all FileSystemRead operations.--allow-fs-read flags.\nExample --allow-fs-read=/folder1/ --allow-fs-read=/folder1/\n
Examples can be found in the File System Permissions documentation.
\n
The initializer module and custom --require modules has a implicit\nread permission.
\n
$ node --permission -r custom-require.js -r custom-require-2.js index.js\n\n
custom-require.js, custom-require-2.js, and index.js will be\nby default in the allowed read list.\n
process.permission.has('fs.read', 'index.js'); // true\nprocess.permission.has('fs.read', 'custom-require.js'); // true\nprocess.permission.has('fs.read', 'custom-require-2.js'); // true\n", "displayName": "`--allow-fs-read`" }, { "textRaw": "`--allow-fs-write`", "name": "`--allow-fs-write`", "type": "module", "meta": { "added": [ "v20.0.0" ], "changes": [ { "version": [ "v23.5.0", "v22.13.0" ], "pr-url": "https://github.com/nodejs/node/pull/56201", "description": "Permission Model and --allow-fs flags are stable." }, { "version": "v20.7.0", "pr-url": "https://github.com/nodejs/node/pull/49047", "description": "Paths delimited by comma (`,`) are no longer allowed." } ] }, "desc": "
This flag configures file system write permissions using\nthe Permission Model.
\n
The valid arguments for the --allow-fs-write flag are:
\n
* - To allow all FileSystemWrite operations.--allow-fs-write flags.\nExample --allow-fs-write=/folder1/ --allow-fs-write=/folder1/\n
Paths delimited by comma (,) are no longer allowed.\nWhen passing a single flag with a comma a warning will be displayed.
\n
Examples can be found in the File System Permissions documentation.
", "displayName": "`--allow-fs-write`" }, { "textRaw": "`--allow-inspector`", "name": "`--allow-inspector`", "type": "module", "meta": { "added": [ "v25.0.0", "v24.12.0" ], "changes": [] }, "stability": 1, "stabilityText": "Early development", "desc": "
When using the Permission Model, the process will not be able to connect\nthrough inspector protocol.
\n
Attempts to do so will throw an ERR_ACCESS_DENIED unless the\nuser explicitly passes the --allow-inspector flag when starting Node.js.
\n
Example:
\n
const { Session } = require('node:inspector/promises');\n\nconst session = new Session();\nsession.connect();\n\n
$ node --permission index.js\nError: connect ERR_ACCESS_DENIED Access to this API has been restricted. Use --allow-inspector to manage permissions.\n code: 'ERR_ACCESS_DENIED',\n}\n", "displayName": "`--allow-inspector`" }, { "textRaw": "`--allow-net`", "name": "`--allow-net`", "type": "module", "meta": { "added": [ "v25.0.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be able to access\nnetwork by default.\nAttempts to do so will throw an ERR_ACCESS_DENIED unless the\nuser explicitly passes the --allow-net flag when starting Node.js.
\n
Example:
\n
const http = require('node:http');\n// Attempt to bypass the permission\nconst req = http.get('http://example.com', () => {});\n\nreq.on('error', (err) => {\n console.log('err', err);\n});\n\n
$ node --permission index.js\nError: connect ERR_ACCESS_DENIED Access to this API has been restricted. Use --allow-net to manage permissions.\n code: 'ERR_ACCESS_DENIED',\n}\n", "displayName": "`--allow-net`" }, { "textRaw": "`--allow-wasi`", "name": "`--allow-wasi`", "type": "module", "meta": { "added": [ "v22.3.0", "v20.16.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be capable of creating\nany WASI instances by default.\nFor security reasons, the call will throw an ERR_ACCESS_DENIED unless the\nuser explicitly passes the flag --allow-wasi in the main Node.js process.
\n
Example:
\n
const { WASI } = require('node:wasi');\n// Attempt to bypass the permission\nnew WASI({\n version: 'preview1',\n // Attempt to mount the whole filesystem\n preopens: {\n '/': '/',\n },\n});\n\n
$ node --permission --allow-fs-read=* index.js\n\nError: Access to this API has been restricted\n at node:internal/main/run_main_module:30:49 {\n code: 'ERR_ACCESS_DENIED',\n permission: 'WASI',\n}\n", "displayName": "`--allow-wasi`" }, { "textRaw": "`--allow-worker`", "name": "`--allow-worker`", "type": "module", "meta": { "added": [ "v20.0.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
When using the Permission Model, the process will not be able to create any\nworker threads by default.\nFor security reasons, the call will throw an ERR_ACCESS_DENIED unless the\nuser explicitly pass the flag --allow-worker in the main Node.js process.
\n
Example:
\n
const { Worker } = require('node:worker_threads');\n// Attempt to bypass the permission\nnew Worker(__filename);\n\n
$ node --permission --allow-fs-read=* index.js\n\nError: Access to this API has been restricted\n at node:internal/main/run_main_module:17:47 {\n code: 'ERR_ACCESS_DENIED',\n permission: 'WorkerThreads'\n}\n", "displayName": "`--allow-worker`" }, { "textRaw": "`--build-sea=config`", "name": "`--build-sea=config`", "type": "module", "meta": { "added": [ "v25.5.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
Generates a single executable application from a JSON\nconfiguration file. The argument must be a path to the configuration file. If\nthe path is not absolute, it is resolved relative to the current working\ndirectory.
\n
For configuration fields, cross-platform notes, and asset APIs, see\nthe single executable application documentation.
", "displayName": "`--build-sea=config`" }, { "textRaw": "`--build-snapshot`", "name": "`--build-snapshot`", "type": "module", "meta": { "added": [ "v18.8.0" ], "changes": [ { "version": [ "v25.4.0", "v24.13.1" ], "pr-url": "https://github.com/nodejs/node/pull/60954", "description": "The snapshot building process is no longer experimental." } ] }, "desc": "
Generates a snapshot blob when the process exits and writes it to\ndisk, which can be loaded later with --snapshot-blob.
\n
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.
\n
$ 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\n
The 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:
\n
$ 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\n
For more information, check out the v8.startupSnapshot API documentation.
\n
The snapshot currently only supports loding a single entrypoint during the\nsnapshot building process, which can load built-in modules, but not additional user-land modules.\nUsers can bundle their applications into a single script with their bundler\nof choice before building a snapshot.
\n
As it's complicated to ensure the serializablility of all built-in modules,\nwhich are also growing over time, only a subset of the built-in modules are\nwell tested to be serializable during the snapshot building process.\nThe Node.js core test suite checks that a few fairly complex applications\ncan be snapshotted. The list of built-in modules being\ncaptured by the built-in snapshot of Node.js is considered supported.\nWhen the snapshot builder encounters a built-in module that cannot be\nserialized, it may crash the snapshot building process. In that case a typical\nworkaround would be to delay loading that module until\nruntime, using either v8.startupSnapshot.setDeserializeMainFunction() or\nv8.startupSnapshot.addDeserializeCallback(). If serialization for\nan additional module during the snapshot building process is needed,\nplease file a request in the Node.js issue tracker and link to it in the\ntracking issue for user-land snapshots.
", "displayName": "`--build-snapshot`" }, { "textRaw": "`--build-snapshot-config`", "name": "`--build-snapshot-config`", "type": "module", "meta": { "added": [ "v21.6.0", "v20.12.0" ], "changes": [ { "version": [ "v25.4.0", "v24.13.1" ], "pr-url": "https://github.com/nodejs/node/pull/60954", "description": "The snapshot building process is no longer experimental." } ] }, "desc": "
Specifies the path to a JSON configuration file which configures snapshot\ncreation behavior.
\n
The following options are currently supported:
\n
builder <string> Required. Provides the name to the script that is executed\nbefore building the snapshot, as if --build-snapshot had been passed\nwith builder as the main script name.withoutCodeCache <boolean> Optional. Including the code cache reduces the\ntime spent on compiling functions included in the snapshot at the expense\nof a bigger snapshot size and potentially breaking portability of the\nsnapshot.\n
When using this flag, additional script files provided on the command line will\nnot be executed and instead be interpreted as regular command line arguments.
", "displayName": "`--build-snapshot-config`" }, { "textRaw": "`-c`, `--check`", "name": "`-c`,_`--check`", "type": "module", "meta": { "added": [ "v5.0.0", "v4.2.0" ], "changes": [ { "version": "v10.0.0", "pr-url": "https://github.com/nodejs/node/pull/19600", "description": "The `--require` option is now supported when checking a file." } ] }, "desc": "
Syntax check the script without executing.
", "displayName": "`-c`, `--check`" }, { "textRaw": "`--completion-bash`", "name": "`--completion-bash`", "type": "module", "meta": { "added": [ "v10.12.0" ], "changes": [] }, "desc": "
Print source-able bash completion script for Node.js.
\n
node --completion-bash > node_bash_completion\nsource node_bash_completion\n", "displayName": "`--completion-bash`" }, { "textRaw": "`-C condition`, `--conditions=condition`", "name": "`-c_condition`,_`--conditions=condition`", "type": "module", "meta": { "added": [ "v14.9.0", "v12.19.0" ], "changes": [ { "version": [ "v22.9.0", "v20.18.0" ], "pr-url": "https://github.com/nodejs/node/pull/54209", "description": "The flag is no longer experimental." } ] }, "desc": "
Provide custom conditional exports resolution conditions.
\n
Any number of custom string condition names are permitted.
\n
The default Node.js conditions of \"node\", \"default\", \"import\", and\n\"require\" will always apply as defined.
\n
For example, to run a module with \"development\" resolutions:
\n
node -C development app.js\n", "displayName": "`-C condition`, `--conditions=condition`" }, { "textRaw": "`--cpu-prof`", "name": "`--cpu-prof`", "type": "module", "meta": { "added": [ "v12.0.0" ], "changes": [ { "version": [ "v22.4.0", "v20.16.0" ], "pr-url": "https://github.com/nodejs/node/pull/53343", "description": "The `--cpu-prof` flags are now stable." } ] }, "desc": "
Starts the V8 CPU profiler on start up, and writes the CPU profile to disk\nbefore exit.
\n
If --cpu-prof-dir is not specified, the generated profile is placed\nin the current working directory.
\n
If --cpu-prof-name is not specified, the generated profile is\nnamed CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile.
\n
$ node --cpu-prof index.js\n$ ls *.cpuprofile\nCPU.20190409.202950.15293.0.0.cpuprofile\n\n
If --cpu-prof-name is specified, the provided value is used as a template\nfor the file name. The following placeholder is supported and will be\nsubstituted at runtime:
\n
${pid} â the current process ID\n
$ node --cpu-prof --cpu-prof-name 'CPU.${pid}.cpuprofile' index.js\n$ ls *.cpuprofile\nCPU.15293.cpuprofile\n", "displayName": "`--cpu-prof`" }, { "textRaw": "`--cpu-prof-dir`", "name": "`--cpu-prof-dir`", "type": "module", "meta": { "added": [ "v12.0.0" ], "changes": [ { "version": [ "v22.4.0", "v20.16.0" ], "pr-url": "https://github.com/nodejs/node/pull/53343", "description": "The `--cpu-prof` flags are now stable." } ] }, "desc": "
Specify the directory where the CPU profiles generated by --cpu-prof will\nbe placed.
\n
The default value is controlled by the\n--diagnostic-dir command-line option.
", "displayName": "`--cpu-prof-dir`" }, { "textRaw": "`--cpu-prof-interval`", "name": "`--cpu-prof-interval`", "type": "module", "meta": { "added": [ "v12.2.0" ], "changes": [ { "version": [ "v22.4.0", "v20.16.0" ], "pr-url": "https://github.com/nodejs/node/pull/53343", "description": "The `--cpu-prof` flags are now stable." } ] }, "desc": "
Specify the sampling interval in microseconds for the CPU profiles generated\nby --cpu-prof. The default is 1000 microseconds.
", "displayName": "`--cpu-prof-interval`" }, { "textRaw": "`--cpu-prof-name`", "name": "`--cpu-prof-name`", "type": "module", "meta": { "added": [ "v12.0.0" ], "changes": [ { "version": [ "v22.4.0", "v20.16.0" ], "pr-url": "https://github.com/nodejs/node/pull/53343", "description": "The `--cpu-prof` flags are now stable." } ] }, "desc": "
Specify the file name of the CPU profile generated by --cpu-prof.
", "displayName": "`--cpu-prof-name`" }, { "textRaw": "`--diagnostic-dir=directory`", "name": "`--diagnostic-dir=directory`", "type": "module", "desc": "
Set the directory to which all diagnostic output files are written.\nDefaults to current working directory.
\n
Affects the default output directory of:
\n
", "displayName": "`--diagnostic-dir=directory`" }, { "textRaw": "`--disable-proto=mode`", "name": "`--disable-proto=mode`", "type": "module", "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.
", "displayName": "`--disable-proto=mode`" }, { "textRaw": "`--disable-sigusr1`", "name": "`--disable-sigusr1`", "type": "module", "meta": { "added": [ "v23.7.0", "v22.14.0" ], "changes": [ { "version": [ "v24.8.0", "v22.20.0" ], "pr-url": "https://github.com/nodejs/node/pull/59707", "description": "The option is no longer experimental." } ] }, "desc": "
Disable the ability of starting a debugging session by sending a\nSIGUSR1 signal to the process.
", "displayName": "`--disable-sigusr1`" }, { "textRaw": "`--disable-warning=code-or-type`", "name": "`--disable-warning=code-or-type`", "type": "module", "meta": { "added": [ "v21.3.0", "v20.11.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
Disable specific process warnings by code or type.
\n
Warnings emitted from process.emitWarning() may contain a\ncode and a type. This option will not-emit warnings that have a matching\ncode or type.
\n
List of deprecation warnings.
\n
The Node.js core warning types are: DeprecationWarning and\nExperimentalWarning
\n
For example, the following script will not emit\nDEP0025 require('node:sys') when executed with\nnode --disable-warning=DEP0025:
\n
import sys from 'node:sys';\n\n
const sys = require('node:sys');\n\n
For example, the following script will emit the\nDEP0025 require('node:sys'), but not any Experimental\nWarnings (such as\nExperimentalWarning: vm.measureMemory is an experimental feature\nin <=v21) when executed with node --disable-warning=ExperimentalWarning:
\n
import sys from 'node:sys';\nimport vm from 'node:vm';\n\nvm.measureMemory();\n\n
const sys = require('node:sys');\nconst vm = require('node:vm');\n\nvm.measureMemory();\n", "displayName": "`--disable-warning=code-or-type`" }, { "textRaw": "`--disable-wasm-trap-handler`", "name": "`--disable-wasm-trap-handler`", "type": "module", "meta": { "added": [ "v22.2.0", "v20.15.0" ], "changes": [ { "version": [ "v26.0.0" ], "pr-url": "https://github.com/nodejs/node/pull/62132", "description": "Node.js now automatically disables the trap handler when there is not enough virtual memory available at startup to allocate one cage." } ] }, "desc": "
Node.js enables V8's trap-handler-based WebAssembly bound checks on 64-bit platforms,\nwhich significantly improves WebAssembly performance by eliminating the need for\ninline bound checks. This optimization requires allocating a large virtual memory\ncage per WebAssembly memory instance (currently typically 8GB for 32-bit WebAssembly memory,\n16GB for 64-bit WebAssembly memory) to trap out-of-bound accesses. On most 64-bit\nplatforms, the virtual memory address space is usually large enough (around 128TB)\nto accommodate typical WebAssembly usages, but if the machine has manual limits\non virtual memory (e.g. through ulimit -v), WebAssembly memory allocation is\nmore likely to fail with WebAssembly.Memory(): could not allocate memory.
\n
At startup, Node.js automatically checks whether there is enough virtual memory\navailable to allocate at least one cage, and if not, the trap-handler optimization\nis automatically disabled so that WebAssembly can still run using inline\nbound checks (with less optimal performance). But if the application needs to create\nmany WebAssembly memory instances and the machine still configures a relatively high\nlimit on virtual memory, allocation of WebAssembly memory instances may still fail\nmore quickly than expected due to the raised virtual memory usage.
\n
--disable-wasm-trap-handler fully disables this optimization so that WebAssembly memory\ninstances always use inline bound checks instead of reserving large virtual memory cages.\nThis allows more instances to be created when the virtual memory address space available\nto the Node.js process is limited.
", "displayName": "`--disable-wasm-trap-handler`" }, { "textRaw": "`--disallow-code-generation-from-strings`", "name": "`--disallow-code-generation-from-strings`", "type": "module", "meta": { "added": [ "v9.8.0" ], "changes": [] }, "desc": "
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.
", "displayName": "`--disallow-code-generation-from-strings`" }, { "textRaw": "`--dns-result-order=order`", "name": "`--dns-result-order=order`", "type": "module", "meta": { "added": [ "v16.4.0", "v14.18.0" ], "changes": [ { "version": [ "v22.1.0", "v20.13.0" ], "pr-url": "https://github.com/nodejs/node/pull/52492", "description": "The `ipv6first` is supported now." }, { "version": "v17.0.0", "pr-url": "https://github.com/nodejs/node/pull/39987", "description": "Changed default value to `verbatim`." } ] }, "desc": "
Set the default value of order in dns.lookup() and\ndnsPromises.lookup(). The value could be:
\n
ipv4first: sets default order to ipv4first.ipv6first: sets default order to ipv6first.verbatim: sets default order to verbatim.\n
The default is verbatim and dns.setDefaultResultOrder() have higher\npriority than --dns-result-order.
", "displayName": "`--dns-result-order=order`" }, { "textRaw": "`--enable-fips`", "name": "`--enable-fips`", "type": "module", "meta": { "added": [ "v6.0.0" ], "changes": [] }, "desc": "
Enable FIPS-compliant crypto at startup. (Requires Node.js to be built\nagainst FIPS-compatible OpenSSL.)
", "displayName": "`--enable-fips`" }, { "textRaw": "`--enable-source-maps`", "name": "`--enable-source-maps`", "type": "module", "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 support for stack traces.
\n
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.
\n
Overriding Error.prepareStackTrace may prevent --enable-source-maps from\nmodifying the stack trace. Call and return the results of the original\nError.prepareStackTrace in the overriding function to modify the stack trace\nwith source maps.
\n
const originalPrepareStackTrace = Error.prepareStackTrace;\nError.prepareStackTrace = (error, trace) => {\n // Modify error and trace and format stack trace with\n // original Error.prepareStackTrace.\n return originalPrepareStackTrace(error, trace);\n};\n\n
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.
", "displayName": "`--enable-source-maps`" }, { "textRaw": "`--entry-url`", "name": "`--entry-url`", "type": "module", "meta": { "added": [ "v23.0.0", "v22.10.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "
When present, Node.js will interpret the entry point as a URL, rather than a\npath.
\n
Follows ECMAScript module resolution rules.
\n
Any query parameter or hash in the URL will be accessible via import.meta.url.
\n
node --entry-url 'file:///path/to/file.js?queryparams=work#and-hashes-too'\nnode --entry-url 'file.ts?query#hash'\nnode --entry-url 'data:text/javascript,console.log(\"Hello\")'\n", "displayName": "`--entry-url`" }, { "textRaw": "`--env-file-if-exists=file`", "name": "`--env-file-if-exists=file`", "type": "module", "meta": { "added": [ "v22.9.0" ], "changes": [ { "version": [ "v24.10.0", "v22.21.0" ], "pr-url": "https://github.com/nodejs/node/pull/59925", "description": "The `--env-file-if-exists` flag is no longer experimental." } ] }, "desc": "
Behavior is the same as --env-file, but an error is not thrown if the file\ndoes not exist.
", "displayName": "`--env-file-if-exists=file`" }, { "textRaw": "`--env-file=file`", "name": "`--env-file=file`", "type": "module", "meta": { "added": [ "v20.6.0" ], "changes": [ { "version": [ "v24.10.0", "v22.21.0" ], "pr-url": "https://github.com/nodejs/node/pull/59925", "description": "The `--env-file` flag is no longer experimental." }, { "version": [ "v21.7.0", "v20.12.0" ], "pr-url": "https://github.com/nodejs/node/pull/51289", "description": "Add support to multi-line values." } ] }, "desc": "
Loads environment variables from a file relative to the current directory,\nmaking them available to applications on process.env. The environment\nvariables which configure Node.js, such as NODE_OPTIONS,\nare parsed and applied. If the same variable is defined in the environment and\nin the file, the value from the environment takes precedence.
\n
You can pass multiple --env-file arguments. Subsequent files override\npre-existing variables defined in previous files.
\n
An error is thrown if the file does not exist.
\n
node --env-file=.env --env-file=.development.env index.js\n\n
The format of the file should be one line per key-value pair of environment\nvariable name and value separated by =:
\n
PORT=3000\n\n
Any text after a # is treated as a comment:
\n
# This is a comment\nPORT=3000 # This is also a comment\n\n
Values can start and end with the following quotes: `, \" or '.\nThey are omitted from the values.
\n
USERNAME=\"nodejs\" # will result in `nodejs` as the value.\n\n
Multi-line values are supported:
\n
MULTI_LINE=\"THIS IS\nA MULTILINE\"\n# will result in `THIS IS\\nA MULTILINE` as the value.\n\n
Export keyword before a key is ignored:
\n
export USERNAME=\"nodejs\" # will result in `nodejs` as the value.\n\n
If you want to load environment variables from a file that may not exist, you\ncan use the --env-file-if-exists flag instead.
", "displayName": "`--env-file=file`" }, { "textRaw": "`-e`, `--eval \"script\"`", "name": "`-e`,_`--eval_\"script\"`", "type": "module", "meta": { "added": [ "v0.5.2" ], "changes": [ { "version": "v22.6.0", "pr-url": "https://github.com/nodejs/node/pull/53725", "description": "Eval now supports experimental type-stripping." }, { "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.
\n
If script starts with -, pass it using = (for example,\nnode --print --eval=-42) so it is parsed as the value of --eval.
\n
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.
\n
It is possible to run code containing inline types unless the\n--no-strip-types flag is provided.
", "displayName": "`-e`, `--eval \"script\"`" }, { "textRaw": "`--experimental-addon-modules`", "name": "`--experimental-addon-modules`", "type": "module", "meta": { "added": [ "v23.6.0", "v22.20.0" ], "changes": [] }, "stability": 1, "stabilityText": "Early development", "desc": "
Enable experimental import support for .node addons.
", "displayName": "`--experimental-addon-modules`" }, { "textRaw": "`--experimental-config-file=path`, `--experimental-config-file`", "name": "`--experimental-config-file=path`,_`--experimental-config-file`", "type": "module", "meta": { "added": [ "v23.10.0", "v22.16.0" ], "changes": [] }, "stability": 1, "stabilityText": "Early development", "desc": "
If present, Node.js will look for a configuration file at the specified path.\nIf the path is not specified, Node.js will look for a node.config.json file\nin the current working directory.\nTo specify a custom path, use the --experimental-config-file=path form.\nThe space-separated --experimental-config-file path form is not supported.\nThe alias --experimental-default-config-file is equivalent to\n--experimental-config-file without an argument.\nNode.js will read the configuration file and apply the settings. The\nconfiguration file should be a JSON file with the following structure. vX.Y.Z\nin the $schema must be replaced with the version of Node.js you are using or\nlatest-vX.x for the latest version of that major release line.
\n
{\n \"$schema\": \"https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json\",\n \"nodeOptions\": {\n \"import\": [\n \"amaro/strip\"\n ],\n \"watch-path\": \"src\",\n \"watch-preserve-output\": true\n },\n \"test\": {\n \"test-isolation\": \"process\"\n },\n \"watch\": {\n \"watch-preserve-output\": true\n }\n}\n\n
The configuration file supports namespace-specific options:
\n
The nodeOptions field contains CLI flags that are allowed in NODE_OPTIONS.
Namespace fields like test, watch, and permission contain configuration specific to that subsystem.
\n
The configuration file can target a specific Node.js major version with\nnodeVersion:
\n
{\n \"nodeVersion\": 25,\n \"nodeOptions\": {\n \"watch-path\": \"src\"\n }\n}\n\n
To keep multiple version-specific configurations in the same file, use the\nconfigs array. Node.js will use the first entry whose nodeVersion matches\nthe current Node.js major version:
\n
{\n \"$schema\": \"https://nodejs.org/dist/latest-v26.x/docs/node-config-schema.json\",\n \"configs\": [\n {\n \"nodeVersion\": 25,\n \"config\": {\n \"$schema\": \"https://nodejs.org/dist/latest-v25.x/docs/node-config-schema.json\",\n \"nodeOptions\": {\n \"watch-path\": \"src\"\n }\n }\n }\n ]\n}\n\n
When configs is used, the top level may only contain $schema and\nconfigs. Each configs item must define an integer nodeVersion and an\nobject config. A single top-level config does not require nodeVersion, but\nif present it must match the current Node.js major version.
\n
When a namespace is present in the\nconfiguration file, Node.js automatically enables the corresponding flag\n(e.g., --test, --watch, --permission). This allows you to configure\nsubsystem-specific options without explicitly passing the flag on the command line.
\n
For example:
\n
{\n \"test\": {\n \"test-isolation\": \"process\"\n }\n}\n\n
is equivalent to:
\n
node --test --test-isolation=process\n\n
To disable the automatic flag while still using namespace options, you can\nexplicitly set the flag to false within the namespace:
\n
{\n \"test\": {\n \"test\": false,\n \"test-isolation\": \"process\"\n }\n}\n\n
No-op flags are not supported.\nNot all V8 flags are currently supported.
\n
It is possible to use the official JSON schema\nto validate the configuration file, which may vary depending on the Node.js version.\nEach key in the configuration file corresponds to a flag that can be passed\nas a command-line argument. The value of the key is the value that would be\npassed to the flag.
\n
For example, the configuration file above is equivalent to\nthe following command-line arguments:
\n
node --import amaro/strip --watch-path=src --watch-preserve-output --test-isolation=process\n\n
The priority in configuration is as follows:
\n
\n
Values in the configuration file will not override the values in the environment\nvariables, command-line options, or the NODE_OPTIONS env file parsed by the\n--env-file flag.
\n
Keys cannot be duplicated within the same or different namespaces.
\n
The configuration parser will throw an error if the configuration file contains\nunknown keys or keys that cannot be used in a namespace.
\n
Node.js will not sanitize or perform validation on the user-provided configuration,\nso NEVER use untrusted configuration files.
", "displayName": "`--experimental-config-file=path`, `--experimental-config-file`" }, { "textRaw": "`--experimental-default-config-file`", "name": "`--experimental-default-config-file`", "type": "module", "meta": { "added": [ "v23.10.0", "v22.16.0" ], "changes": [] }, "stability": 1, "stabilityText": "Early development", "desc": "
This flag is an alias for --experimental-config-file without an argument.\nIf present, Node.js will look for a\nnode.config.json file in the current working directory and load it as a\nconfiguration file.
", "displayName": "`--experimental-default-config-file`" }, { "textRaw": "`--experimental-eventsource`", "name": "`--experimental-eventsource`", "type": "module", "meta": { "added": [ "v22.3.0", "v20.18.0" ], "changes": [] }, "desc": "
Enable exposition of EventSource Web API on the global scope.
", "displayName": "`--experimental-eventsource`" }, { "textRaw": "`--experimental-ffi`", "name": "`--experimental-ffi`", "type": "module", "meta": { "added": [ "v26.1.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "
Enable the experimental node:ffi module.
\n
This flag is only available in builds with FFI support.
", "displayName": "`--experimental-ffi`" }, { "textRaw": "`--experimental-import-meta-resolve`", "name": "`--experimental-import-meta-resolve`", "type": "module", "meta": { "added": [ "v13.9.0", "v12.16.2" ], "changes": [ { "version": [ "v20.6.0", "v18.19.0" ], "pr-url": "https://github.com/nodejs/node/pull/49028", "description": "synchronous import.meta.resolve made available by default, with the flag retained for enabling the experimental second argument as previously supported." } ] }, "desc": "
Enable experimental import.meta.resolve() parent URL support, which allows\npassing a second parentURL argument for contextual resolution.
\n
Previously gated the entire import.meta.resolve feature.
", "displayName": "`--experimental-import-meta-resolve`" }, { "textRaw": "`--experimental-inspector-network-resource`", "name": "`--experimental-inspector-network-resource`", "type": "module", "meta": { "added": [ "v24.5.0", "v22.19.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active Development", "desc": "
Enable experimental support for inspector network resources.
", "displayName": "`--experimental-inspector-network-resource`" }, { "textRaw": "`--experimental-loader=module`", "name": "`--experimental-loader=module`", "type": "module", "meta": { "added": [ "v8.8.0" ], "changes": [ { "version": [ "v23.6.1", "v22.13.1", "v20.18.2" ], "pr-url": "https://github.com/nodejs-private/node-private/pull/629", "description": "Using this feature with the permission model enabled requires passing `--allow-worker`." }, { "version": "v12.11.1", "pr-url": "https://github.com/nodejs/node/pull/29752", "description": "This flag was renamed from `--loader` to `--experimental-loader`." } ] }, "desc": "
\nThis flag is discouraged and may be removed in a future version of Node.js.\nPlease use\n
\n--importwithregister()instead.
\n
Specify the module containing exported asynchronous module customization hooks.\nmodule may be any string accepted as an import specifier.
\n
This feature requires --allow-worker if used with the Permission Model.
", "displayName": "`--experimental-loader=module`" }, { "textRaw": "`--experimental-network-inspection`", "name": "`--experimental-network-inspection`", "type": "module", "meta": { "added": [ "v22.6.0", "v20.18.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "
Enable experimental support for the network inspection with Chrome DevTools.
", "displayName": "`--experimental-network-inspection`" }, { "textRaw": "`--experimental-print-required-tla`", "name": "`--experimental-print-required-tla`", "type": "module", "meta": { "added": [ "v22.0.0", "v20.17.0" ], "changes": [] }, "desc": "
If the ES module being require()'d contains top-level await, this flag\nallows Node.js to evaluate the module, try to locate the\ntop-level awaits, and print their location to help users find them.
", "displayName": "`--experimental-print-required-tla`" }, { "textRaw": "`--experimental-quic`", "name": "`--experimental-quic`", "type": "module", "meta": { "added": [ "v25.0.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active development", "desc": "
Enable experimental support for the QUIC protocol.
", "displayName": "`--experimental-quic`" }, { "textRaw": "`--experimental-sea-config`", "name": "`--experimental-sea-config`", "type": "module", "meta": { "added": [ "v20.0.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "
Use this flag to generate a blob that can be injected into the Node.js\nbinary to produce a single executable application. See the documentation\nabout this configuration for details.
", "displayName": "`--experimental-sea-config`" }, { "textRaw": "`--experimental-shadow-realm`", "name": "`--experimental-shadow-realm`", "type": "module", "meta": { "added": [ "v19.0.0", "v18.13.0" ], "changes": [] }, "desc": "
Use this flag to enable ShadowRealm support.
", "displayName": "`--experimental-shadow-realm`" }, { "textRaw": "`--experimental-storage-inspection`", "name": "`--experimental-storage-inspection`", "type": "module", "meta": { "added": [ "v25.5.0" ], "changes": [] }, "stability": 1.1, "stabilityText": "Active Development", "desc": "
Enable experimental support for storage inspection
", "displayName": "`--experimental-storage-inspection`" }, { "textRaw": "`--experimental-stream-iter`", "name": "`--experimental-stream-iter`", "type": "module", "meta": { "added": [ "v25.9.0" ], "changes": [] }, "stability": 1, "stabilityText": "Experimental", "desc": "
Enable the experimental node:stream/iter module.
", "displayName": "`--experimental-stream-iter`" }, { "textRaw": "`--experimental-test-coverage`", "name": "`--experimental-test-coverage`", "type": "module", "meta": { "added": [ "v19.7.0", "v18.15.0" ], "changes": [ { "version": [ "v20.1.0", "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.
", "displayName": "`--experimental-test-coverage`" }, { "textRaw": "`--experimental-test-module-mocks`", "name": "`--experimental-test-module-mocks`", "type": "module", "meta": { "added": [ "v22.3.0", "v20.18.0" ], "changes": [ { "version": [ "v23.6.1", "v22.13.1", "v20.18.2" ], "pr-url": "https://github.com/nodejs-private/node-private/pull/629", "description": "Using this feature with the permission model enabled requires passing `--allow-worker`." } ] }, "stability": 1, "stabilityText": "Early development", "desc": "
Enable module mocking in the test runner.
\n
This feature requires --allow-worker if used with the Permission Model.
",
"displayName": "`--experimental-test-module-mocks`"
},
{
"textRaw": "`--experimental-test-tag-filter= Run only tests whose tag set contains The flag may be specified more than once; tests must contain every\nfilter value to run. See Test tags for details on declaring and\ninheriting tags. Enable experimental ES Module support in the Enable experimental WebAssembly System Interface (WASI) support. Enable experimental support for the worker inspection with Chrome DevTools. This flag will expose the gc extension from V8. 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 Enforces 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. Enable experimental frozen intrinsics like Only the root context is supported. There is no guarantee that\n To allow polyfills to be added,\n Starts the V8 heap profiler on start up, and writes the heap profile to disk\nbefore exit. If If Specify the directory where the heap profiles generated by The default value is controlled by the\n Specify the average sampling interval in bytes for the heap profiles generated\nby Specify the file name of the heap profile generated by Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the\nheap limit. 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 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. Enables a signal handler that causes the Node.js process to write a heap dump\nwhen the specified signal is received. Print node command-line options.\nThe output of this option is less detailed than this document. Specify ICU data load path. (Overrides Preload the specified module at startup. If the flag is provided several times,\neach module will be executed sequentially in the order they appear, starting\nwith the ones provided in Follows ECMAScript module resolution rules.\nUse Modules are preloaded into the main thread as well as any worker threads,\nforked processes, or clustered processes. This configures Node.js to interpret If To avoid the delay of multiple syntax detection passes, the The REPL does not support this option. Usage of Enable leniency flags on the HTTP parser. This may allow\ninteroperability with non-conformant HTTP implementations. When enabled, the parser will accept the following: All the above will expose your application to request smuggling\nor poisoning attack. Avoid using this option. Activate inspector on See V8 Inspector integration for Node.js for further explanation on Node.js debugger. See the security warning below regarding the Set the Default host is See the security warning below regarding the Specify ways of the inspector web socket url exposure. By default inspector websocket url is available in stderr and under Activate inspector on See V8 Inspector integration for Node.js for further explanation on Node.js debugger. See the security warning below regarding the Activate inspector on 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.\nSee V8 Inspector integration for Node.js for further explanation on Node.js debugger. Binding the inspector to a public IP (including If specifying a host, make sure that either: More specifically, See the debugging security implications section for more information. Opens the REPL even if stdin does not appear to be a terminal. 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. The file used to store Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB. Sets the maximum memory size of V8's old memory section as a percentage of available system memory.\nThis flag takes precedence over The Note: This flag utilizes This option is a no-op. It is kept for compatibility. Sets the default value for the network family autoselection attempt timeout.\nFor more information, see Disable the Disables the use of Silence deprecation warnings. Disable using syntax detection to determine module type. Disable exposition of Navigator API on the global scope. Use this flag to disable top-level await in REPL. Legacy alias for Disable the experimental Disable exposition of Disable Hide extra information on fatal exception that causes exit. Disables runtime checks for Do not search modules from global paths like Disables the family autoselection algorithm unless connection options explicitly\nenables it. Disable support for loading a synchronous ES module graph in See Loading ECMAScript modules using Disable type-stripping for TypeScript files.\nFor more information, see the TypeScript type-stripping documentation. 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 3.0 legacy provider. For more information please see\nOSSL_PROVIDER-legacy. Enable OpenSSL default configuration section, 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 Enable the Permission Model for current process. When enabled, the\nfollowing permissions are restricted: Enable audit only for the permission model. When enabled, permission checks\nare performed but access is not denied. Instead, a warning is emitted for\neach permission violation via diagnostics channel. 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 The Note, however, that using The Instructs the module loader to preserve symbolic links when resolving and\ncaching the main module ( This flag exists so that the main module can be opted-in to the same behavior\nthat See Identical to Generate V8 profiler output. Process V8 profiler output generated using the V8 option 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 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. When Exclude Name of the file to which the report will be written. If the filename is set to 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 Sets or resets the signal for report generation (not supported on Windows).\nDefault signal is 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. Preload the specified module at startup. Follows Modules preloaded with Modules are preloaded into the main thread as well as any worker threads,\nforked processes, or clustered processes. This runs a specified command from a package.json's For example, the following command will run the You can also pass arguments to the command. Any argument after The following environment variables are set when running a script with When using Initializes an OpenSSL secure heap of 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 When used with When used without When loading a snapshot, Node.js checks that: If they don't match, Node.js refuses to load the snapshot and exits with\nstatus code 1. Starts the Node.js command line test runner. This flag cannot be combined with\n The maximum number of test files that the test runner CLI will execute\nconcurrently. If Require a minimum percent of covered branches. If code coverage does not reach\nthe threshold specified, the process will exit with code Excludes specific files from code coverage using a glob pattern, which can match\nboth absolute and relative file paths. This option may be specified multiple times to exclude multiple glob patterns. If both By default all the matching test files are excluded from the coverage report.\nSpecifying this option will override the default behavior. Require a minimum percent of covered functions. If code coverage does not reach\nthe threshold specified, the process will exit with code Includes specific files in code coverage using a glob pattern, which can match\nboth absolute and relative file paths. This option may be specified multiple times to include multiple glob patterns. If both Require a minimum percent of covered lines. If code coverage does not reach\nthe threshold specified, the process will exit with code Configures the test runner to exit the process once all known tests have\nfinished executing even if the event loop would otherwise remain active. Specify a module that will be evaluated before all tests are executed and\ncan be used to setup global state or fixtures for tests. See the documentation on global setup and teardown for more details. Configures the type of test isolation used in the test runner. When 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. If both Configures the test runner to only execute top level tests that have the Set the seed used to randomize test execution order. This applies to both test\nfile execution order and queued tests within each file. Providing this flag\nenables randomization implicitly, even without The value must be an integer between This flag cannot be used with Randomize test execution order. This applies to both test file execution order\nand queued tests within each file. This can help detect tests that rely on\nshared state or execution order. The seed used for randomization is printed in the test summary and can be\nreused with For detailed behavior and examples, see\nrandomizing tests execution order. This flag cannot be used with A test reporter to use when running tests. See the documentation on\ntest reporters for more details. The destination for the corresponding test reporter. See the documentation on\ntest reporters for more details. A path to a file allowing the test runner to persist the state of the test\nsuite between runs. The test runner will use this file to determine which tests\nhave already succeeded or failed, allowing for re-running of failed tests\nwithout having to re-run the entire test suite. The test runner will create this\nfile if it does not exist.\nSee the documentation on test reruns for more details. Test suite shard to execute in a format of This command will divide all tests files into For example, to split your tests suite into three parts, use this: A regular expression that configures the test runner to skip tests\nwhose name matches the provided pattern. See the documentation on\nfiltering tests by name for more details. If both A number of milliseconds the test execution will fail after. If unspecified,\nsubtests inherit this value from their parent. The default value is Regenerates the snapshot files used by the test runner for snapshot testing. Throw errors for deprecations. Set 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 Set Set default Set default Set default Set default Set default Print stack traces for deprecations. Print information about any access to environment variables done in the current Node.js\ninstance to stderr, including: Only the names of the environment variables being accessed are printed. The values are not printed. To print the stack trace of the access, use In addition to what In addition to what A comma separated list of categories that should be traced when trace event\ntracing is enabled using Template string specifying the filepath for the trace event data, it\nsupports Enables the collection of trace event tracing information. Prints a stack trace whenever an environment is exited proactively,\ni.e. invoking Prints information about usage of Loading ECMAScript modules using When 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 Print stack traces for uncaught exceptions; usually, the stack trace associated\nwith the creation of an 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: 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 When enabled, Node.js parses the This is equivalent to setting the 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 Node.js uses the trusted CA certificates present in the system store along with\nthe On Windows and macOS, the certificate trust policy is similar to\nChromium's policy for locally trusted certificates, but with some differences: On macOS, the following settings are respected: On Windows, the following settings are respected: On Windows and macOS, Node.js would check that the user settings for the trusted\ncertificates do not forbid them for TLS server authentication before using them. Node.js currently does not support distrust/revocation of certificates\nfrom another source based on system settings. On other systems, Node.js loads certificates from the default certificate file\n(typically Print V8 command-line options. Set V8's thread pool size which will be used to allocate background jobs. If set to 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. Print node's version. 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 This flag cannot be combined with\n Note: The Customizes the signal sent to the process on watch mode restarts. 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 This flag cannot be combined with\n Note: Using This option is only supported on macOS and Windows.\nAn Disable the clearing of the console when watch mode restarts the process. Automatically zero-fills all newly allocated The When Any other value will result in colorized output being disabled. Enable the module compile cache for the Node.js instance. See the documentation of\nmodule compile cache for details. When set to 1, the module compile cache can be reused across different directory\nlocations as long as the module layout relative to the cache directory remains the same. When set, colors will not be used in the REPL. Disable the module compile cache for the Node.js instance. See the documentation of\nmodule compile cache for details. When set, the well known \"root\" CAs (like VeriSign) will be extended with the\nextra certificates in Neither the well known nor extra certificates are used when the This environment variable is ignored when The Data path for ICU ( When set to A space-separated list of command-line options. If an option value contains a space, it can be escaped using double quotes: A singleton flag passed as a command-line option will override the same flag\npassed into A flag that can be passed multiple times will be treated as if its\n Node.js options that are allowed are in the following list. If an option\nsupports both --XX and --no-XX variants, they are both supported but only\none is included in the list below. V8 options that are allowed are: On Windows, this is a When set to 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 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 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 Path to a Node.js module which will be loaded in place of the built-in REPL.\nOverriding this value to an empty string ( Path to the file used to store the persistent REPL history. The default path is\n If If If When enabled, Node.js parses the This can also be enabled using the Node.js uses the trusted CA certificates present in the system store along with\nthe This can also be enabled using the 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 is output as an array of ScriptCoverage objects on the top-level\nkey If found, source map data is appended to the top-level key 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 If the If 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 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. The While Node.js does not support all of the various ways that Set the number of threads used in libuv's threadpool to 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: 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 V8 has its own set of CLI options. Any V8 CLI option that is provided to Specifies the maximum heap size (in megabytes) for the process. This option is typically used to limit the amount of memory the process can use for its JavaScript heap. 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. Sets the maximum semi-space size for V8's scavenge garbage collector in\nMiB (mebibytes).\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\n The default value depends on the memory limit. For example, on 64-bit systems\nwith a memory limit of 512 MiB, the max size of a semi-space defaults to 1 MiB.\nFor memory limits up to and including 2GiB, the default max size of a\nsemi-space will be less than 16 MiB on 64-bit systems. To get 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: The maximum number of stack frames to collect in an error's stack trace.\nSetting it to 0 disables stack trace collection. The default value is 10.<tag>. Tests declare tags via the\ntags option on test(), it(), suite(), or describe(); tags\ninherit from suites to nested tests by union. Filtering is\ncase-insensitive.node:vm module.
",
"displayName": "`--expose-gc`"
},
{
"textRaw": "`--force-context-aware`",
"name": "`--force-context-aware`",
"type": "module",
"meta": {
"added": [
"v12.12.0"
],
"changes": []
},
"desc": "if (globalThis.gc) {\n globalThis.gc();\n}\n--enable-fips.)uncaughtException event on Node-API asynchronous callbacks.Array and Object.globalThis.Array is indeed the default intrinsic reference. Code may break\nunder this flag.--require and --import both run before freezing intrinsics.--heap-prof-dir is not specified, the generated profile is placed\nin the current working directory.--heap-prof-name is not specified, the generated profile is\nnamed Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile.
",
"displayName": "`--heap-prof`"
},
{
"textRaw": "`--heap-prof-dir`",
"name": "`--heap-prof-dir`",
"type": "module",
"meta": {
"added": [
"v12.4.0"
],
"changes": [
{
"version": [
"v22.4.0",
"v20.16.0"
],
"pr-url": "https://github.com/nodejs/node/pull/53343",
"description": "The `--heap-prof` flags are now stable."
}
]
},
"desc": "$ node --heap-prof index.js\n$ ls *.heapprofile\nHeap.20190409.202950.15293.0.001.heapprofile\n--heap-prof will\nbe placed.--diagnostic-dir command-line option.--heap-prof. The default is 512 * 1024 bytes.--heap-prof.count should be a non-negative integer (in which case\nNode.js will write no more than max_count snapshots to disk).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.
",
"displayName": "`--heapsnapshot-near-heap-limit=max_count`"
},
{
"textRaw": "`--heapsnapshot-signal=signal`",
"name": "`--heapsnapshot-signal=signal`",
"type": "module",
"meta": {
"added": [
"v12.0.0"
],
"changes": []
},
"desc": "$ 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....\nsignal must be a valid signal name.\nDisabled by default.
",
"displayName": "`--heapsnapshot-signal=signal`"
},
{
"textRaw": "`-h`, `--help`",
"name": "`-h`,_`--help`",
"type": "module",
"meta": {
"added": [
"v0.1.3"
],
"changes": []
},
"desc": "$ 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\nNODE_ICU_DATA.)NODE_OPTIONS.--require to load a CommonJS module.\nModules preloaded with --require will run before modules preloaded with --import.--eval or STDIN input as CommonJS or\nas an ES module. Valid values are \"commonjs\", \"module\", \"module-typescript\" and \"commonjs-typescript\".\nThe \"-typescript\" values are not available with the flag --no-strip-types.\nThe default is no value, or \"commonjs\" if --no-experimental-detect-module is passed.--input-type is not provided,\nNode.js will try to detect the syntax with the following steps:\n
\nERR_UNSUPPORTED_TYPESCRIPT_SYNTAX\nor ERR_INVALID_TYPESCRIPT_SYNTAX,\nthrow the error from step 2, including the TypeScript error in the message,\nelse run as CommonJS.--input-type=type flag can be used to specify\nhow the --eval input should be interpreted.--input-type=module with\n--print will throw an error, as --print does not support ES module\nsyntax.\n
\nTransfer-Encoding\nand Content-Length headers.Connection: close is present.chunked has been provided.\\n to be used as token separator instead of \\r\\n.\\r\\n not to be provided after a chunk.\\r\\n.host:port and break at start of user script.\nDefault host:port is 127.0.0.1:9229. If port 0 is specified,\na random available port will be used.host\nparameter usage.host:port to be used when the inspector is activated.\nUseful when activating the inspector by sending the SIGUSR1 signal.\nExcept when --disable-sigusr1 is passed.127.0.0.1. If port 0 is specified,\na random available port will be used.host\nparameter usage./json/list\nendpoint on http://host:port/json/list.host:port and wait for debugger to be attached.\nDefault host:port is 127.0.0.1:9229. If port 0 is specified,\na random available port will be used.host\nparameter usage.host:port. Default is 127.0.0.1:9229. If port 0 is\nspecified, a random available port will be used.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.\n
\n--inspect=0.0.0.0 is insecure if the port (9229 by\ndefault) is not firewall-protected.localStorage data. If the file does not exist, it is\ncreated the first time localStorage is accessed. The same file may be shared\nbetween multiple Node.js processes concurrently.--max-old-space-size when both are specified.percentage parameter must be a number greater than 0 and up to 100, representing the percentage\nof available system memory to allocate to the V8 heap.--max-old-space-size, which may be unreliable on 32-bit platforms due to\ninteger overflow issues.
",
"displayName": "`--max-old-space-size-percentage=percentage`"
},
{
"textRaw": "`--napi-modules`",
"name": "`--napi-modules`",
"type": "module",
"meta": {
"added": [
"v7.10.0"
],
"changes": []
},
"desc": "# Using 50% of available system memory\nnode --max-old-space-size-percentage=50 index.js\n\n# Using 75% of available system memory\nnode --max-old-space-size-percentage=75 index.js\nnet.getDefaultAutoSelectFamilyAttemptTimeout().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.AsyncLocalStorage backed by AsyncContextFrame and\nuses the prior implementation which relied on async_hooks. The previous model\nis retained for compatibility with Electron and for cases where the context\nflow may differ. However, if a difference in flow is found please report it.--no-require-module.node:sqlite module.<WebSocket> on the global scope.Web Storage support.async_hooks. These will still be enabled\ndynamically when async_hooks is enabled.$HOME/.node_modules and\n$NODE_PATH.require().require().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.--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.\n
",
"displayName": "`--permission`"
},
{
"textRaw": "`--permission-audit`",
"name": "`--permission-audit`",
"type": "module",
"meta": {
"added": [
"v25.8.0"
],
"changes": []
},
"desc": "--allow-fs-read, --allow-fs-write flags--allow-net flag--allow-child-process flag--allow-worker flag--allow-wasi flag--allow-addons flag--allow-ffi flagmoduleA attempts to require moduleB as a peer dependency:
\n{appDir}\n âââ app\n â âââ index.js\n â âââ node_modules\n â âââ moduleA -> {appDir}/moduleA\n â âââ moduleB\n â âââ index.js\n â âââ package.json\n âââ moduleA\n âââ index.js\n âââ package.json\n--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 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).--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.require.main).--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.--preserve-symlinks for more information.-e but prints the result.--prof.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.--report-exclude-env is passed the diagnostic report generated will not\ncontain the environmentVariables data.header.networkInterfaces from the diagnostic report. By default\nthis is not set and the network interfaces are included.'stdout' or 'stderr', the report is written to\nthe stdout or stderr of the process respectively.--report-signal.SIGUSR2.require()'s module resolution\nrules. module may be either a path to a file, or a node module name.--require will run before modules preloaded with --import.\"scripts\" object.\nIf a missing \"command\" is provided, it will list the available scripts.--run will traverse up to the root directory and finds a package.json\nfile to run the command from.--run prepends ./node_modules/.bin for each ancestor of\nthe current directory, to the PATH in order to execute the binaries from\ndifferent folders where multiple node_modules directories are present, if\nancestor-folder/node_modules/.bin is a directory.--run executes the command in the directory containing the related package.json.test script of\nthe package.json in the current folder:
\n$ node --run test\n-- will\nbe appended to the script:
",
"modules": [
{
"textRaw": "Intentional limitations",
"name": "intentional_limitations",
"type": "module",
"desc": "$ node --run test -- --verbose\nnode --run is not meant to match the behaviors of npm run or of the run\ncommands of other package managers. The Node.js implementation is intentionally\nmore limited, in order to focus on top performance for the most common use\ncases.\nSome features of other run implementations that are intentionally excluded\nare:\n
",
"displayName": "Intentional limitations"
},
{
"textRaw": "Environment variables",
"name": "environment_variables",
"type": "module",
"desc": "pre or post scripts in addition to the specified script.--run:\n
",
"displayName": "Environment variables"
}
],
"displayName": "`--run`"
},
{
"textRaw": "`--secure-heap-min=n`",
"name": "`--secure-heap-min=n`",
"type": "module",
"meta": {
"added": [
"v15.6.0"
],
"changes": []
},
"desc": "NODE_RUN_SCRIPT_NAME: The name of the script being run. For example, if\n--run is used to run test, the value of this variable will be test.NODE_RUN_PACKAGE_JSON_PATH: The path to the package.json that is being\nprocessed.--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.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.CRYPTO_secure_malloc_init for more details.--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.--build-snapshot, --snapshot-blob specifies the\npath to the blob that is used to restore the application state.\n
\n--watch-path, --check, --eval, --interactive, or the inspector.\nSee the documentation on running tests from the command line\nfor more details.--test-isolation is set to 'none', this flag is ignored and\nconcurrency is one. Otherwise, concurrency defaults to\nos.availableParallelism() - 1.1.--test-coverage-exclude and --test-coverage-include are provided,\nfiles must meet both criteria to be included in the coverage report.1.--test-coverage-exclude and --test-coverage-include are provided,\nfiles must meet both criteria to be included in the coverage report.1.mode is\n'process', each test file is run in a separate child process. When mode is\n'none', all test files run in the same process as the test runner. The default\nisolation mode is 'process'. This flag is ignored if the --test flag is not\npresent. See the test runner execution model section for more information.--test-name-pattern and --test-skip-pattern are supplied,\ntests must satisfy both requirements in order to be executed.only\noption set. This flag is not necessary when test isolation is disabled.--test-randomize.0 and 4294967295.--watch or --test-rerun-failures.--test-random-seed.--watch or --test-rerun-failures.<index>/<total>, where\n
\nindex is a positive integer, index of divided parts.total is a positive integer, total of divided part.total equal parts,\nand will run only those that happen to be in an index part.
",
"displayName": "`--test-shard`"
},
{
"textRaw": "`--test-skip-pattern`",
"name": "`--test-skip-pattern`",
"type": "module",
"meta": {
"added": [
"v22.1.0"
],
"changes": []
},
"desc": "node --test --test-shard=1/3\nnode --test --test-shard=2/3\nnode --test --test-shard=3/3\n--test-name-pattern and --test-skip-pattern are supplied,\ntests must satisfy both requirements in order to be executed.Infinity.process.title on startup.SSLKEYLOGFILE\nformat and can be used by software (such as Wireshark) to decrypt the TLS\ntraffic.tls.DEFAULT_MAX_VERSION to 'TLSv1.2'. Use to disable support for\nTLSv1.3.tls.DEFAULT_MAX_VERSION to 'TLSv1.3'. Use to enable support\nfor TLSv1.3.tls.DEFAULT_MIN_VERSION to 'TLSv1'. Use for compatibility with\nold TLS clients or servers.tls.DEFAULT_MIN_VERSION to 'TLSv1.1'. Use for compatibility\nwith old TLS clients or servers.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.tls.DEFAULT_MIN_VERSION to 'TLSv1.3'. Use to disable support\nfor TLSv1.2, which is not as secure as TLSv1.3.\n
\nprocess.env.KEY = \"SOME VALUE\".process.env.KEY.Object.defineProperty(process.env, 'KEY', {...}).Object.hasOwn(process.env, 'KEY'),\nprocess.env.hasOwnProperty('KEY') or 'KEY' in process.env.delete process.env.KEY....process.env or Object.keys(process.env).--trace-env-js-stack and/or\n--trace-env-native-stack.--trace-env does, this prints the JavaScript stack trace of the access.--trace-env does, this prints the native stack trace of the access.--trace-events-enabled.${rotation} and ${pid}.process.exit().require().mode is all, all usage is printed. When mode is no-node-modules, usage\nfrom the node_modules folder is excluded.stderr. This can be used to debug TLS\nconnection problems.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).\n
\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.SSL_CERT_DIR and SSL_CERT_FILE.HTTP_PROXY, HTTPS_PROXY and NO_PROXY\nenvironment variables during startup, and tunnels requests over the\nspecified proxy.NODE_USE_ENV_PROXY=1 environment variable.\nWhen both are set, --use-env-proxy takes precedence.mode:\n
",
"displayName": "`--use-largepages=mode`"
},
{
"textRaw": "`--use-system-ca`",
"name": "`--use-system-ca`",
"type": "module",
"meta": {
"added": [
"v23.8.0"
],
"changes": [
{
"version": "v23.9.0",
"pr-url": "https://github.com/nodejs/node/pull/57009",
"description": "Added support on non-Windows and non-macOS."
}
]
},
"desc": "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.--use-bundled-ca option and the NODE_EXTRA_CA_CERTS environment variable.\nOn platforms other than Windows and macOS, this loads certificates from the directory\nand file trusted by OpenSSL, similar to --use-openssl-ca, with the difference being\nthat it caches the certificates after first load.\n
\n\n
\n\n
\n\n
\ncertlm.msc)\n\n
\n\n
\ncertmgr.msc)\n\n
\n\n
\n/etc/ssl/cert.pem) and default certificate directory (typically\n/etc/ssl/certs) that the version of OpenSSL that Node.js links to respects.\nThis typically works with the convention on major Linux distributions and other\nUnix-like systems. If the overriding OpenSSL environment variables\n(typically SSL_CERT_FILE and SSL_CERT_DIR, depending on the configuration\nof the OpenSSL that Node.js links to) are set, the specified paths will be used to load\ncertificates instead. These environment variables can be used as workarounds\nif the conventional paths used by the version of OpenSSL Node.js links to are\nnot consistent with the system configuration that the users have for some reason.0 then Node.js will choose an appropriate size of the thread pool\nbased on an estimate of the amount of parallelism.--watch-path to specify what paths to watch.--check, --eval, --interactive, or the REPL.--watch flag requires a file path as an argument and is incompatible\nwith --run or inline script input, as --run takes precedence and ignores watch\nmode. If no file is provided, Node.js will exit with status code 9.
",
"displayName": "`--watch`"
},
{
"textRaw": "`--watch-kill-signal`",
"name": "`--watch-kill-signal`",
"type": "module",
"meta": {
"added": [
"v24.4.0",
"v22.18.0"
],
"changes": []
},
"stability": 1.1,
"stabilityText": "Active Development",
"desc": "node --watch index.js\n
",
"displayName": "`--watch-kill-signal`"
},
{
"textRaw": "`--watch-path`",
"name": "`--watch-path`",
"type": "module",
"meta": {
"added": [
"v18.11.0",
"v16.19.0"
],
"changes": [
{
"version": [
"v22.0.0",
"v20.13.0"
],
"pr-url": "https://github.com/nodejs/node/pull/52074",
"description": "Watch mode is now stable."
}
]
},
"desc": "node --watch --watch-kill-signal SIGINT test.js\n--watch.--check, --eval, --interactive, --test, or the REPL.--watch-path implicitly enables --watch, which requires a file path\nand is incompatible with --run, as --run takes precedence and ignores watch mode.
\nnode --watch-path=./src --watch-path=./tests index.js\nERR_FEATURE_UNAVAILABLE_ON_PLATFORM exception will be thrown\nwhen the option is used on a platform that does not support it.
",
"displayName": "`--watch-preserve-output`"
},
{
"textRaw": "`--zero-fill-buffers`",
"name": "`--zero-fill-buffers`",
"type": "module",
"meta": {
"added": [
"v6.0.0"
],
"changes": []
},
"desc": "node --watch --watch-preserve-output test.js\nBuffer instances.FORCE_COLOR environment variable is used to\nenable ANSI colorized output. The value may be:\n
\n1, true, or the empty string '' indicate 16-color support,2 to indicate 256-color support, or3 to indicate 16 million-color support.FORCE_COLOR is used and set to a supported value, both the NO_COLOR,\nand NODE_DISABLE_COLORS environment variables are ignored.','-separated list of core modules that should print debug information.','-separated list of core C++ modules that should print debug information.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.ca\noptions property is explicitly specified for a TLS or HTTPS client or server.node runs as setuid root or\nhas Linux file capabilities set.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.Intl object) data. Will extend linked-in data when compiled\nwith small-icu support.1, process warnings are silenced.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.
\nNODE_OPTIONS='--require \"./my path/file.js\"'\nNODE_OPTIONS:
\n# The inspector will be available on port 5555\nNODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555\nNODE_OPTIONS instances were passed first, and then its command-line\ninstances afterwards:
\nNODE_OPTIONS='--require \"./a.js\"' node --require \"./b.js\"\n# is equivalent to:\nnode --require \"./a.js\" --require \"./b.js\"\n\n
\n--allow-addons--allow-child-process--allow-ffi--allow-fs-read--allow-fs-write--allow-inspector--allow-net--allow-wasi--allow-worker--conditions, -C--cpu-prof-dir--cpu-prof-interval--cpu-prof-name--cpu-prof--diagnostic-dir--disable-proto--disable-sigusr1--disable-warning--disable-wasm-trap-handler--dns-result-order--enable-fips--enable-network-family-autoselection--enable-source-maps--entry-url--experimental-abortcontroller--experimental-addon-modules--experimental-detect-module--experimental-eventsource--experimental-ffi--experimental-import-meta-resolve--experimental-json-modules--experimental-loader--experimental-modules--experimental-print-required-tla--experimental-quic--experimental-require-module--experimental-shadow-realm--experimental-specifier-resolution--experimental-stream-iter--experimental-test-isolation--experimental-top-level-await--experimental-vm-modules--experimental-wasi-unstable-preview1--force-context-aware--force-fips--force-node-api-uncaught-exceptions-policy--frozen-intrinsics--heap-prof-dir--heap-prof-interval--heap-prof-name--heap-prof--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-wait--inspect--localstorage-file--max-http-header-size--max-old-space-size-percentage--napi-modules--network-family-autoselection-attempt-timeout--no-addons--no-async-context-frame--no-deprecation--no-experimental-global-navigator--no-experimental-repl-await--no-experimental-sqlite--no-experimental-strip-types--no-experimental-websocket--no-experimental-webstorage--no-extra-info-on-fatal-exception--no-force-async-hooks-checks--no-global-search-paths--no-network-family-autoselection--no-strip-types--no-warnings--no-webstorage--node-memory-debug--openssl-config--openssl-legacy-provider--openssl-shared-config--pending-deprecation--permission-audit--permission--preserve-symlinks-main--preserve-symlinks--prof-process--redirect-warnings--report-compact--report-dir, --report-directory--report-exclude-env--report-exclude-network--report-filename--report-on-fatalerror--report-on-signal--report-signal--report-uncaught-exception--require-module--require, -r--secure-heap-min--secure-heap--snapshot-blob--test-coverage-branches--test-coverage-exclude--test-coverage-functions--test-coverage-include--test-coverage-lines--test-global-setup--test-isolation--test-name-pattern--test-only--test-random-seed--test-randomize--test-reporter-destination--test-reporter--test-rerun-failures--test-shard--test-skip-pattern--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-deprecation--trace-env-js-stack--trace-env-native-stack--trace-env--trace-event-categories--trace-event-file-pattern--trace-events-enabled--trace-exit--trace-require-module--trace-sigint--trace-sync-io--trace-tls--trace-uncaught--trace-warnings--track-heap-objects--unhandled-rejections--use-bundled-ca--use-env-proxy--use-largepages--use-openssl-ca--use-system-ca--v8-pool-size--watch-kill-signal--watch-path--watch-preserve-output--watch--zero-fill-buffers\n
\n--abort-on-uncaught-exception--disallow-code-generation-from-strings--enable-etw-stack-walking--expose-gc--interpreted-frames-native-stack--jitless--max-heap-size--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.';'-separated list instead.1, emit pending deprecation warnings.--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.1, instructs the module loader to preserve symbolic links when\nresolving and caching modules.--redirect-warnings=file command-line flag.'') will use the built-in REPL.~/.node_repl_history, which is overridden by this variable. Setting the value\nto an empty string ('' or ' ') disables persistent REPL history.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 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.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.HTTP_PROXY, HTTPS_PROXY and NO_PROXY\nenvironment variables during startup, and tunnels requests over the\nspecified proxy.--use-env-proxy command-line flag.\nWhen both are set, --use-env-proxy takes precedence.--use-bundled-ca option and the NODE_EXTRA_CA_CERTS environment variable.--use-system-ca command-line flag.\nWhen both are set, --use-system-ca takes precedence.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.result:
",
"displayName": "Coverage output"
},
{
"textRaw": "Source map cache",
"name": "source_map_cache",
"type": "module",
"stability": 1,
"stabilityText": "Experimental",
"desc": "{\n \"result\": [\n {\n \"scriptId\": \"67\",\n \"url\": \"internal/tty.js\",\n \"functions\": []\n }\n ]\n}\nsource-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).
",
"displayName": "Source map cache"
}
],
"displayName": "`NODE_V8_COVERAGE=dir`"
},
{
"textRaw": "`NO_COLOR={\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}\nNO_COLOR is an alias for NODE_DISABLE_COLORS. The value of the\nenvironment variable is arbitrary../configure --openssl-fips.--openssl-config command-line option is used, the environment\nvariable is ignored.--use-openssl-ca is enabled, or if --use-system-ca is enabled on\nplatforms other than macOS and Windows, this overrides and sets OpenSSL's directory\ncontaining trusted certificates.--use-openssl-ca is enabled, or if --use-system-ca is enabled on\nplatforms other than macOS and Windows, this overrides and sets OpenSSL's file\ncontaining trusted certificates.TZ environment variable is used to specify the timezone configuration.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.
",
"displayName": "`TZ`"
},
{
"textRaw": "`UV_THREADPOOL_SIZE=size`",
"name": "`uv_threadpool_size=size`",
"type": "module",
"desc": "$ TZ=Europe/Dublin node -pe \"new Date().toString()\"\nWed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)\nsize threads.\n
\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 synchronous'UV_THREADPOOL_SIZE' environment variable to a value\ngreater than 4 (its current default value). However, setting this from inside\nthe process using process.env.UV_THREADPOOL_SIZE=size is not guaranteed to work\nas the threadpool would have been created as part of the runtime initialisation\nmuch before user code is run. For more information, see the libuv threadpool documentation.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:
\n",
"displayName": "`--max-old-space-size=SIZE` (in MiB)"
},
{
"textRaw": "`--max-semi-space-size=SIZE` (in MiB)",
"name": "`--max-semi-space-size=size`_(in_mib)",
"type": "module",
"desc": "node --max-old-space-size=1536 index.js\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).
",
"displayName": "`--max-semi-space-size=SIZE` (in MiB)"
},
{
"textRaw": "`--perf-basic-prof`",
"name": "`--perf-basic-prof`",
"type": "module",
"displayName": "`--perf-basic-prof`"
},
{
"textRaw": "`--perf-basic-prof-only-functions`",
"name": "`--perf-basic-prof-only-functions`",
"type": "module",
"displayName": "`--perf-basic-prof-only-functions`"
},
{
"textRaw": "`--perf-prof`",
"name": "`--perf-prof`",
"type": "module",
"displayName": "`--perf-prof`"
},
{
"textRaw": "`--perf-prof-unwinding-info`",
"name": "`--perf-prof-unwinding-info`",
"type": "module",
"displayName": "`--perf-prof-unwinding-info`"
},
{
"textRaw": "`--prof`",
"name": "`--prof`",
"type": "module",
"displayName": "`--prof`"
},
{
"textRaw": "`--security-revert`",
"name": "`--security-revert`",
"type": "module",
"displayName": "`--security-revert`"
},
{
"textRaw": "`--stack-trace-limit=limit`",
"name": "`--stack-trace-limit=limit`",
"type": "module",
"desc": "for MiB in 16 32 64 128; do\n node --max-semi-space-size=$MiB index.js\ndone\n
",
"displayName": "`--stack-trace-limit=limit`"
}
],
"displayName": "Useful V8 options"
}
]
}
]
}node --stack-trace-limit=12 -p -e \"Error.stackTraceLimit\" # prints 12\n