1# Command-line options 2 3<!--introduced_in=v5.9.1--> 4<!--type=misc--> 5 6Node.js comes with a variety of CLI options. These options expose built-in 7debugging, multiple ways to execute scripts, and other helpful runtime options. 8 9To view this documentation as a manual page in a terminal, run `man node`. 10 11## Synopsis 12 13`node [options] [V8 options] [script.js | -e "script" | -] [--] [arguments]` 14 15`node inspect [script.js | -e "script" | <host>:<port>] …` 16 17`node --v8-options` 18 19Execute without arguments to start the [REPL][]. 20 21For more info about `node inspect`, see the [debugger][] documentation. 22 23## Options 24<!-- YAML 25changes: 26 - version: v10.12.0 27 pr-url: https://github.com/nodejs/node/pull/23020 28 description: Underscores instead of dashes are now allowed for 29 Node.js options as well, in addition to V8 options. 30--> 31 32All options, including V8 options, allow words to be separated by both 33dashes (`-`) or underscores (`_`). For example, `--pending-deprecation` is 34equivalent to `--pending_deprecation`. 35 36If an option that takes a single value (such as `--max-http-header-size`) is 37passed more than once, then the last passed value is used. Options from the 38command line take precedence over options passed through the [`NODE_OPTIONS`][] 39environment variable. 40 41### `-` 42<!-- YAML 43added: v8.0.0 44--> 45 46Alias for stdin. Analogous to the use of `-` in other command-line utilities, 47meaning that the script is read from stdin, and the rest of the options 48are passed to that script. 49 50### `--` 51<!-- YAML 52added: v6.11.0 53--> 54 55Indicate the end of node options. Pass the rest of the arguments to the script. 56If no script filename or eval/print script is supplied prior to this, then 57the next argument is used as a script filename. 58 59### `--abort-on-uncaught-exception` 60<!-- YAML 61added: v0.10.8 62--> 63 64Aborting instead of exiting causes a core file to be generated for post-mortem 65analysis using a debugger (such as `lldb`, `gdb`, and `mdb`). 66 67If this flag is passed, the behavior can still be set to not abort through 68[`process.setUncaughtExceptionCaptureCallback()`][] (and through usage of the 69`domain` module that uses it). 70 71### `--completion-bash` 72<!-- YAML 73added: v10.12.0 74--> 75 76Print source-able bash completion script for Node.js. 77 78```console 79$ node --completion-bash > node_bash_completion 80$ source node_bash_completion 81``` 82 83### `-C=condition`, `--conditions=condition` 84<!-- YAML 85added: v14.9.0 86--> 87 88> Stability: 1 - Experimental 89 90Enable experimental support for custom [conditional exports][] resolution 91conditions. 92 93Any number of custom string condition names are permitted. 94 95The default Node.js conditions of `"node"`, `"default"`, `"import"`, and 96`"require"` will always apply as defined. 97 98For example, to run a module with "development" resolutions: 99 100```console 101$ node -C=development app.js 102``` 103 104### `--cpu-prof` 105<!-- YAML 106added: v12.0.0 107--> 108 109> Stability: 1 - Experimental 110 111Starts the V8 CPU profiler on start up, and writes the CPU profile to disk 112before exit. 113 114If `--cpu-prof-dir` is not specified, the generated profile is placed 115in the current working directory. 116 117If `--cpu-prof-name` is not specified, the generated profile is 118named `CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`. 119 120```console 121$ node --cpu-prof index.js 122$ ls *.cpuprofile 123CPU.20190409.202950.15293.0.0.cpuprofile 124``` 125 126### `--cpu-prof-dir` 127<!-- YAML 128added: v12.0.0 129--> 130 131> Stability: 1 - Experimental 132 133Specify the directory where the CPU profiles generated by `--cpu-prof` will 134be placed. 135 136The default value is controlled by the 137[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option. 138 139### `--cpu-prof-interval` 140<!-- YAML 141added: v12.2.0 142--> 143 144> Stability: 1 - Experimental 145 146Specify the sampling interval in microseconds for the CPU profiles generated 147by `--cpu-prof`. The default is 1000 microseconds. 148 149### `--cpu-prof-name` 150<!-- YAML 151added: v12.0.0 152--> 153 154> Stability: 1 - Experimental 155 156Specify the file name of the CPU profile generated by `--cpu-prof`. 157 158### `--diagnostic-dir=directory` 159 160Set the directory to which all diagnostic output files are written. 161Defaults to current working directory. 162 163Affects the default output directory of: 164* [--cpu-prof-dir](#cli_cpu_prof_dir) 165* [--heap-prof-dir](#cli_heap_prof_dir) 166* [--redirect-warnings](#cli_redirect_warnings_file) 167 168### `--disable-proto=mode` 169<!-- YAML 170added: v13.12.0 171--> 172 173Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the 174property is removed entirely. If `mode` is `throw`, accesses to the 175property throw an exception with the code `ERR_PROTO_ACCESS`. 176 177### `--disallow-code-generation-from-strings` 178<!-- YAML 179added: v9.8.0 180--> 181 182Make built-in language features like `eval` and `new Function` that generate 183code from strings throw an exception instead. This does not affect the Node.js 184`vm` module. 185 186### `--dns-result-order=order` 187<!-- YAML 188added: v14.18.0 189--> 190 191Set the default value of `verbatim` in [`dns.lookup()`][] and 192[`dnsPromises.lookup()`][]. The value could be: 193* `ipv4first`: sets default `verbatim` `false`. 194* `verbatim`: sets default `verbatim` `true`. 195 196The default is `ipv4first` and [`dns.setDefaultResultOrder()`][] have higher 197priority than `--dns-result-order`. 198 199### `--enable-fips` 200<!-- YAML 201added: v6.0.0 202--> 203 204Enable FIPS-compliant crypto at startup. (Requires Node.js to be built 205against FIPS-compatible OpenSSL.) 206 207### `--enable-source-maps` 208<!-- YAML 209added: v12.12.0 210changes: 211 - version: v14.18.0 212 pr-url: https://github.com/nodejs/node/pull/37362 213 description: This API is no longer experimental. 214--> 215 216Enable [Source Map v3][Source Map] support for stack traces. 217 218When using a transpiler, such as TypeScript, strack traces thrown by an 219application reference the transpiled code, not the original source position. 220`--enable-source-maps` enables caching of Source Maps and makes a best 221effort to report stack traces relative to the original source file. 222 223Overriding `Error.prepareStackTrace` prevents `--enable-source-maps` from 224modifiying the stack trace. 225 226### `--experimental-abortcontroller` 227<!-- YAML 228added: v14.17.0 229--> 230 231Enable experimental `AbortController` and `AbortSignal` support. 232 233### `--experimental-import-meta-resolve` 234<!-- YAML 235added: 236 - v13.9.0 237 - v12.16.2 238--> 239 240Enable experimental `import.meta.resolve()` support. 241 242### `--experimental-json-modules` 243<!-- YAML 244added: v12.9.0 245--> 246 247Enable experimental JSON support for the ES Module loader. 248 249### `--experimental-loader=module` 250<!-- YAML 251added: v9.0.0 252--> 253 254Specify the `module` of a custom experimental [ECMAScript Module loader][]. 255`module` may be either a path to a file, or an ECMAScript Module name. 256 257### `--experimental-modules` 258<!-- YAML 259added: v8.5.0 260--> 261 262Enable latest experimental modules features (deprecated). 263 264### `--experimental-policy` 265<!-- YAML 266added: v11.8.0 267--> 268 269Use the specified file as a security policy. 270 271### `--experimental-repl-await` 272<!-- YAML 273added: v10.0.0 274--> 275 276Enable experimental top-level `await` keyword support in REPL. 277 278### `--experimental-specifier-resolution=mode` 279<!-- YAML 280added: 281 - v13.4.0 282 - v12.16.0 283--> 284 285Sets the resolution algorithm for resolving ES module specifiers. Valid options 286are `explicit` and `node`. 287 288The default is `explicit`, which requires providing the full path to a 289module. The `node` mode enables support for optional file extensions and 290the ability to import a directory that has an index file. 291 292See [customizing ESM specifier resolution][] for example usage. 293 294### `--experimental-vm-modules` 295<!-- YAML 296added: v9.6.0 297--> 298 299Enable experimental ES Module support in the `vm` module. 300 301### `--experimental-wasi-unstable-preview1` 302<!-- YAML 303added: 304 - v13.3.0 305 - v12.16.0 306changes: 307 - version: v13.6.0 308 pr-url: https://github.com/nodejs/node/pull/30980 309 description: changed from `--experimental-wasi-unstable-preview0` to 310 `--experimental-wasi-unstable-preview1`. 311--> 312 313Enable experimental WebAssembly System Interface (WASI) support. 314 315### `--experimental-wasm-modules` 316<!-- YAML 317added: v12.3.0 318--> 319 320Enable experimental WebAssembly module support. 321 322### `--force-context-aware` 323<!-- YAML 324added: v12.12.0 325--> 326 327Disable loading native addons that are not [context-aware][]. 328 329### `--force-fips` 330<!-- YAML 331added: v6.0.0 332--> 333 334Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) 335(Same requirements as `--enable-fips`.) 336 337### `--frozen-intrinsics` 338<!-- YAML 339added: v11.12.0 340--> 341 342> Stability: 1 - Experimental 343 344Enable experimental frozen intrinsics like `Array` and `Object`. 345 346Support is currently only provided for the root context and no guarantees are 347currently provided that `global.Array` is indeed the default intrinsic 348reference. Code may break under this flag. 349 350`--require` runs prior to freezing intrinsics in order to allow polyfills to 351be added. 352 353### `--heapsnapshot-near-heap-limit=max_count` 354<!-- YAML 355added: v14.18.0 356--> 357 358> Stability: 1 - Experimental 359 360Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the 361heap limit. `count` should be a non-negative integer (in which case 362Node.js will write no more than `max_count` snapshots to disk). 363 364When generating snapshots, garbage collection may be triggered and bring 365the heap usage down, therefore multiple snapshots may be written to disk 366before the Node.js instance finally runs out of memory. These heap snapshots 367can be compared to determine what objects are being allocated during the 368time consecutive snapshots are taken. It's not guaranteed that Node.js will 369write exactly `max_count` snapshots to disk, but it will try 370its best to generate at least one and up to `max_count` snapshots before the 371Node.js instance runs out of memory when `max_count` is greater than `0`. 372 373Generating V8 snapshots takes time and memory (both memory managed by the 374V8 heap and native memory outside the V8 heap). The bigger the heap is, 375the more resources it needs. Node.js will adjust the V8 heap to accommondate 376the additional V8 heap memory overhead, and try its best to avoid using up 377all the memory avialable to the process. When the process uses 378more memory than the system deems appropriate, the process may be terminated 379abruptly by the system, depending on the system configuration. 380 381```console 382$ node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js 383Wrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot 384Wrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot 385Wrote snapshot to Heap.20200430.100038.49580.0.003.heapsnapshot 386 387<--- Last few GCs ---> 388 389[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 390[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 391 392 393<--- JS stacktrace ---> 394 395FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 396.... 397``` 398 399### `--heapsnapshot-signal=signal` 400<!-- YAML 401added: v12.0.0 402--> 403 404Enables a signal handler that causes the Node.js process to write a heap dump 405when the specified signal is received. `signal` must be a valid signal name. 406Disabled by default. 407 408```console 409$ node --heapsnapshot-signal=SIGUSR2 index.js & 410$ ps aux 411USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 412node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js 413$ kill -USR2 1 414$ ls 415Heap.20190718.133405.15554.0.001.heapsnapshot 416``` 417 418### `--heap-prof` 419<!-- YAML 420added: v12.4.0 421--> 422 423> Stability: 1 - Experimental 424 425Starts the V8 heap profiler on start up, and writes the heap profile to disk 426before exit. 427 428If `--heap-prof-dir` is not specified, the generated profile is placed 429in the current working directory. 430 431If `--heap-prof-name` is not specified, the generated profile is 432named `Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile`. 433 434```console 435$ node --heap-prof index.js 436$ ls *.heapprofile 437Heap.20190409.202950.15293.0.001.heapprofile 438``` 439 440### `--heap-prof-dir` 441<!-- YAML 442added: v12.4.0 443--> 444 445> Stability: 1 - Experimental 446 447Specify the directory where the heap profiles generated by `--heap-prof` will 448be placed. 449 450The default value is controlled by the 451[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option. 452 453### `--heap-prof-interval` 454<!-- YAML 455added: v12.4.0 456--> 457 458> Stability: 1 - Experimental 459 460Specify the average sampling interval in bytes for the heap profiles generated 461by `--heap-prof`. The default is 512 * 1024 bytes. 462 463### `--heap-prof-name` 464<!-- YAML 465added: v12.4.0 466--> 467 468> Stability: 1 - Experimental 469 470Specify the file name of the heap profile generated by `--heap-prof`. 471 472### `--icu-data-dir=file` 473<!-- YAML 474added: v0.11.15 475--> 476 477Specify ICU data load path. (Overrides `NODE_ICU_DATA`.) 478 479### `--input-type=type` 480<!-- YAML 481added: v12.0.0 482--> 483 484This configures Node.js to interpret string input as CommonJS or as an ES 485module. String input is input via `--eval`, `--print`, or `STDIN`. 486 487Valid values are `"commonjs"` and `"module"`. The default is `"commonjs"`. 488 489### `--inspect-brk[=[host:]port]` 490<!-- YAML 491added: v7.6.0 492--> 493 494Activate inspector on `host:port` and break at start of user script. 495Default `host:port` is `127.0.0.1:9229`. 496 497### `--inspect-port=[host:]port` 498<!-- YAML 499added: v7.6.0 500--> 501 502Set the `host:port` to be used when the inspector is activated. 503Useful when activating the inspector by sending the `SIGUSR1` signal. 504 505Default host is `127.0.0.1`. 506 507See the [security warning](#inspector_security) below regarding the `host` 508parameter usage. 509 510### `--inspect[=[host:]port]` 511<!-- YAML 512added: v6.3.0 513--> 514 515Activate inspector on `host:port`. Default is `127.0.0.1:9229`. 516 517V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug 518and profile Node.js instances. The tools attach to Node.js instances via a 519tcp port and communicate using the [Chrome DevTools Protocol][]. 520 521<a id="inspector_security"></a> 522#### Warning: binding inspector to a public IP:port combination is insecure 523 524Binding the inspector to a public IP (including `0.0.0.0`) with an open port is 525insecure, as it allows external hosts to connect to the inspector and perform 526a [remote code execution][] attack. 527 528If specifying a host, make sure that either: 529 530* The host is not accessible from public networks. 531* A firewall disallows unwanted connections on the port. 532 533**More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by 534default) is not firewall-protected.** 535 536See the [debugging security implications][] section for more information. 537 538### `--inspect-publish-uid=stderr,http` 539 540Specify ways of the inspector web socket url exposure. 541 542By default inspector websocket url is available in stderr and under `/json/list` 543endpoint on `http://host:port/json/list`. 544 545### `--insecure-http-parser` 546<!-- YAML 547added: 548 - v13.4.0 549 - v12.15.0 550 - v10.19.0 551--> 552 553Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow 554interoperability with non-conformant HTTP implementations. It may also allow 555request smuggling and other HTTP attacks that rely on invalid headers being 556accepted. Avoid using this option. 557 558### `--jitless` 559<!-- YAML 560added: v12.0.0 561--> 562 563Disable [runtime allocation of executable memory][jitless]. This may be 564required on some platforms for security reasons. It can also reduce attack 565surface on other platforms, but the performance impact may be severe. 566 567This flag is inherited from V8 and is subject to change upstream. It may 568disappear in a non-semver-major release. 569 570### `--max-http-header-size=size` 571<!-- YAML 572added: 573 - v11.6.0 574 - v10.15.0 575changes: 576 - version: v14.0.0 577 pr-url: https://github.com/nodejs/node/pull/32520 578 description: Change maximum default size of HTTP headers from 8KB to 16KB. 579--> 580 581Specify the maximum size, in bytes, of HTTP headers. Defaults to 16KB. 582 583### `--napi-modules` 584<!-- YAML 585added: v7.10.0 586--> 587 588This option is a no-op. It is kept for compatibility. 589 590### `--no-addons` 591<!-- YAML 592added: v14.19.0 593--> 594 595Disable the `node-addons` exports condition as well as disable loading 596native addons. When `--no-addons` is specified, calling `process.dlopen` or 597requiring a native C++ addon will fail and throw an exception. 598 599### `--no-deprecation` 600<!-- YAML 601added: v0.8.0 602--> 603 604Silence deprecation warnings. 605 606### `--no-force-async-hooks-checks` 607<!-- YAML 608added: v9.0.0 609--> 610 611Disables runtime checks for `async_hooks`. These will still be enabled 612dynamically when `async_hooks` is enabled. 613 614### `--no-warnings` 615<!-- YAML 616added: v6.0.0 617--> 618 619Silence all process warnings (including deprecations). 620 621### `--node-memory-debug` 622<!-- YAML 623added: v14.18.0 624--> 625 626Enable extra debug checks for memory leaks in Node.js internals. This is 627usually only useful for developers debugging Node.js itself. 628 629### `--openssl-config=file` 630<!-- YAML 631added: v6.9.0 632--> 633 634Load an OpenSSL configuration file on startup. Among other uses, this can be 635used to enable FIPS-compliant crypto if Node.js is built 636against FIPS-enabled OpenSSL. 637 638### `--pending-deprecation` 639<!-- YAML 640added: v8.0.0 641--> 642 643Emit pending deprecation warnings. 644 645Pending deprecations are generally identical to a runtime deprecation with the 646notable exception that they are turned *off* by default and will not be emitted 647unless either the `--pending-deprecation` command-line flag, or the 648`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations 649are used to provide a kind of selective "early warning" mechanism that 650developers may leverage to detect deprecated API usage. 651 652### `--policy-integrity=sri` 653<!-- YAML 654added: v12.7.0 655--> 656 657> Stability: 1 - Experimental 658 659Instructs Node.js to error prior to running any code if the policy does not have 660the specified integrity. It expects a [Subresource Integrity][] string as a 661parameter. 662 663### `--preserve-symlinks` 664<!-- YAML 665added: v6.3.0 666--> 667 668Instructs the module loader to preserve symbolic links when resolving and 669caching modules. 670 671By default, when Node.js loads a module from a path that is symbolically linked 672to a different on-disk location, Node.js will dereference the link and use the 673actual on-disk "real path" of the module as both an identifier and as a root 674path to locate other dependency modules. In most cases, this default behavior 675is acceptable. However, when using symbolically linked peer dependencies, as 676illustrated in the example below, the default behavior causes an exception to 677be thrown if `moduleA` attempts to require `moduleB` as a peer dependency: 678 679```text 680{appDir} 681 ├── app 682 │ ├── index.js 683 │ └── node_modules 684 │ ├── moduleA -> {appDir}/moduleA 685 │ └── moduleB 686 │ ├── index.js 687 │ └── package.json 688 └── moduleA 689 ├── index.js 690 └── package.json 691``` 692 693The `--preserve-symlinks` command-line flag instructs Node.js to use the 694symlink path for modules as opposed to the real path, allowing symbolically 695linked peer dependencies to be found. 696 697Note, however, that using `--preserve-symlinks` can have other side effects. 698Specifically, symbolically linked *native* modules can fail to load if those 699are linked from more than one location in the dependency tree (Node.js would 700see those as two separate modules and would attempt to load the module multiple 701times, causing an exception to be thrown). 702 703The `--preserve-symlinks` flag does not apply to the main module, which allows 704`node --preserve-symlinks node_module/.bin/<foo>` to work. To apply the same 705behavior for the main module, also use `--preserve-symlinks-main`. 706 707### `--preserve-symlinks-main` 708<!-- YAML 709added: v10.2.0 710--> 711 712Instructs the module loader to preserve symbolic links when resolving and 713caching the main module (`require.main`). 714 715This flag exists so that the main module can be opted-in to the same behavior 716that `--preserve-symlinks` gives to all other imports; they are separate flags, 717however, for backward compatibility with older Node.js versions. 718 719`--preserve-symlinks-main` does not imply `--preserve-symlinks`; use 720`--preserve-symlinks-main` in addition to 721`--preserve-symlinks` when it is not desirable to follow symlinks before 722resolving relative paths. 723 724See `--preserve-symlinks` for more information. 725 726### `--prof` 727<!-- YAML 728added: v2.0.0 729--> 730 731Generate V8 profiler output. 732 733### `--prof-process` 734<!-- YAML 735added: v5.2.0 736--> 737 738Process V8 profiler output generated using the V8 option `--prof`. 739 740### `--redirect-warnings=file` 741<!-- YAML 742added: v8.0.0 743--> 744 745Write process warnings to the given file instead of printing to stderr. The 746file will be created if it does not exist, and will be appended to if it does. 747If an error occurs while attempting to write the warning to the file, the 748warning will be written to stderr instead. 749 750The `file` name may be an absolute path. If it is not, the default directory it 751will be written to is controlled by the 752[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option. 753 754### `--report-compact` 755<!-- YAML 756added: v13.12.0 757--> 758 759Write reports in a compact format, single-line JSON, more easily consumable 760by log processing systems than the default multi-line format designed for 761human consumption. 762 763### `--report-dir=directory`, `report-directory=directory` 764<!-- YAML 765added: v11.8.0 766changes: 767 - version: v13.12.0 768 pr-url: https://github.com/nodejs/node/pull/32242 769 description: This option is no longer experimental. 770 - version: v12.0.0 771 pr-url: https://github.com/nodejs/node/pull/27312 772 description: Changed from `--diagnostic-report-directory` to 773 `--report-directory`. 774--> 775 776Location at which the report will be generated. 777 778### `--report-filename=filename` 779<!-- YAML 780added: v11.8.0 781changes: 782 - version: v13.12.0 783 pr-url: https://github.com/nodejs/node/pull/32242 784 description: This option is no longer experimental. 785 - version: v12.0.0 786 pr-url: https://github.com/nodejs/node/pull/27312 787 description: changed from `--diagnostic-report-filename` to 788 `--report-filename`. 789--> 790 791Name of the file to which the report will be written. 792 793### `--report-on-fatalerror` 794<!-- YAML 795added: v11.8.0 796changes: 797 - version: v14.0.0 798 pr-url: https://github.com/nodejs/node/pull/32496 799 description: This option is no longer experimental. 800 - version: v12.0.0 801 pr-url: https://github.com/nodejs/node/pull/27312 802 description: changed from `--diagnostic-report-on-fatalerror` to 803 `--report-on-fatalerror`. 804--> 805 806Enables the report to be triggered on fatal errors (internal errors within 807the Node.js runtime such as out of memory) that lead to termination of the 808application. Useful to inspect various diagnostic data elements such as heap, 809stack, event loop state, resource consumption etc. to reason about the fatal 810error. 811 812### `--report-on-signal` 813<!-- YAML 814added: v11.8.0 815changes: 816 - version: v13.12.0 817 pr-url: https://github.com/nodejs/node/pull/32242 818 description: This option is no longer experimental. 819 - version: v12.0.0 820 pr-url: https://github.com/nodejs/node/pull/27312 821 description: changed from `--diagnostic-report-on-signal` to 822 `--report-on-signal`. 823--> 824 825Enables report to be generated upon receiving the specified (or predefined) 826signal to the running Node.js process. The signal to trigger the report is 827specified through `--report-signal`. 828 829### `--report-signal=signal` 830<!-- YAML 831added: v11.8.0 832changes: 833 - version: v13.12.0 834 pr-url: https://github.com/nodejs/node/pull/32242 835 description: This option is no longer experimental. 836 - version: v12.0.0 837 pr-url: https://github.com/nodejs/node/pull/27312 838 description: changed from `--diagnostic-report-signal` to 839 `--report-signal`. 840--> 841 842Sets or resets the signal for report generation (not supported on Windows). 843Default signal is `SIGUSR2`. 844 845### `--report-uncaught-exception` 846<!-- YAML 847added: v11.8.0 848changes: 849 - version: v13.12.0 850 pr-url: https://github.com/nodejs/node/pull/32242 851 description: This option is no longer experimental. 852 - version: v12.0.0 853 pr-url: https://github.com/nodejs/node/pull/27312 854 description: changed from `--diagnostic-report-uncaught-exception` to 855 `--report-uncaught-exception`. 856--> 857 858Enables report to be generated on uncaught exceptions. Useful when inspecting 859the JavaScript stack in conjunction with native stack and other runtime 860environment data. 861 862### `--throw-deprecation` 863<!-- YAML 864added: v0.11.14 865--> 866 867Throw errors for deprecations. 868 869### `--title=title` 870<!-- YAML 871added: v10.7.0 872--> 873 874Set `process.title` on startup. 875 876### `--tls-cipher-list=list` 877<!-- YAML 878added: v4.0.0 879--> 880 881Specify an alternative default TLS cipher list. Requires Node.js to be built 882with crypto support (default). 883 884### `--tls-keylog=file` 885<!-- YAML 886added: 887 - v13.2.0 888 - v12.16.0 889--> 890 891Log TLS key material to a file. The key material is in NSS `SSLKEYLOGFILE` 892format and can be used by software (such as Wireshark) to decrypt the TLS 893traffic. 894 895### `--tls-max-v1.2` 896<!-- YAML 897added: 898 - v12.0.0 899 - v10.20.0 900--> 901 902Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for 903TLSv1.3. 904 905### `--tls-max-v1.3` 906<!-- YAML 907added: v12.0.0 908--> 909 910Set default [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.3'. Use to enable support 911for TLSv1.3. 912 913### `--tls-min-v1.0` 914<!-- YAML 915added: 916 - v12.0.0 917 - v10.20.0 918--> 919 920Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1'. Use for compatibility with 921old TLS clients or servers. 922 923### `--tls-min-v1.1` 924<!-- YAML 925added: 926 - v12.0.0 927 - v10.20.0 928--> 929 930Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.1'. Use for compatibility 931with old TLS clients or servers. 932 933### `--tls-min-v1.2` 934<!-- YAML 935added: 936 - v12.2.0 937 - v10.20.0 938--> 939 940Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.2'. This is the default for 94112.x and later, but the option is supported for compatibility with older Node.js 942versions. 943 944### `--tls-min-v1.3` 945<!-- YAML 946added: v12.0.0 947--> 948 949Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support 950for TLSv1.2, which is not as secure as TLSv1.3. 951 952### `--trace-atomics-wait` 953<!-- YAML 954added: v14.3.0 955--> 956 957Print short summaries of calls to [`Atomics.wait()`][] to stderr. 958The output could look like this: 959 960```text 961(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started 962(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched 963(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started 964(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out 965(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started 966(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started 967(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread 968(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread 969``` 970 971The fields here correspond to: 972 973* The thread id as given by [`worker_threads.threadId`][] 974* The base address of the `SharedArrayBuffer` in question, as well as the 975 byte offset corresponding to the index passed to `Atomics.wait()` 976* The expected value that was passed to `Atomics.wait()` 977* The timeout passed to `Atomics.wait` 978 979### `--trace-deprecation` 980<!-- YAML 981added: v0.8.0 982--> 983 984Print stack traces for deprecations. 985 986### `--trace-event-categories` 987<!-- YAML 988added: v7.7.0 989--> 990 991A comma separated list of categories that should be traced when trace event 992tracing is enabled using `--trace-events-enabled`. 993 994### `--trace-event-file-pattern` 995<!-- YAML 996added: v9.8.0 997--> 998 999Template string specifying the filepath for the trace event data, it 1000supports `${rotation}` and `${pid}`. 1001 1002### `--trace-events-enabled` 1003<!-- YAML 1004added: v7.7.0 1005--> 1006 1007Enables the collection of trace event tracing information. 1008 1009### `--trace-exit` 1010<!-- YAML 1011added: 1012 - v13.5.0 1013 - v12.16.0 1014--> 1015 1016Prints a stack trace whenever an environment is exited proactively, 1017i.e. invoking `process.exit()`. 1018 1019### `--trace-sigint` 1020<!-- YAML 1021added: v13.9.0 1022--> 1023 1024Prints a stack trace on SIGINT. 1025 1026### `--trace-sync-io` 1027<!-- YAML 1028added: v2.1.0 1029--> 1030 1031Prints a stack trace whenever synchronous I/O is detected after the first turn 1032of the event loop. 1033 1034### `--trace-tls` 1035<!-- YAML 1036added: v12.2.0 1037--> 1038 1039Prints TLS packet trace information to `stderr`. This can be used to debug TLS 1040connection problems. 1041 1042### `--trace-uncaught` 1043<!-- YAML 1044added: v13.1.0 1045--> 1046 1047Print stack traces for uncaught exceptions; usually, the stack trace associated 1048with the creation of an `Error` is printed, whereas this makes Node.js also 1049print the stack trace associated with throwing the value (which does not need 1050to be an `Error` instance). 1051 1052Enabling this option may affect garbage collection behavior negatively. 1053 1054### `--trace-warnings` 1055<!-- YAML 1056added: v6.0.0 1057--> 1058 1059Print stack traces for process warnings (including deprecations). 1060 1061### `--track-heap-objects` 1062<!-- YAML 1063added: v2.4.0 1064--> 1065 1066Track heap object allocations for heap snapshots. 1067 1068### `--unhandled-rejections=mode` 1069<!-- YAML 1070added: 1071 - v12.0.0 1072 - v10.17.0 1073--> 1074 1075By default all unhandled rejections trigger a warning plus a deprecation warning 1076for the very first unhandled rejection in case no [`unhandledRejection`][] hook 1077is used. 1078 1079Using this flag allows to change what should happen when an unhandled rejection 1080occurs. One of the following modes can be chosen: 1081 1082* `throw`: Emit [`unhandledRejection`][]. If this hook is not set, raise the 1083 unhandled rejection as an uncaught exception. 1084* `strict`: Raise the unhandled rejection as an uncaught exception. 1085* `warn`: Always trigger a warning, no matter if the [`unhandledRejection`][] 1086 hook is set or not but do not print the deprecation warning. 1087* `warn-with-error-code`: Emit [`unhandledRejection`][]. If this hook is not 1088 set, trigger a warning, and set the process exit code to 1. 1089* `none`: Silence all warnings. 1090 1091### `--use-bundled-ca`, `--use-openssl-ca` 1092<!-- YAML 1093added: v6.11.0 1094--> 1095 1096Use bundled Mozilla CA store as supplied by current Node.js version 1097or use OpenSSL's default CA store. The default store is selectable 1098at build-time. 1099 1100The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store 1101that is fixed at release time. It is identical on all supported platforms. 1102 1103Using OpenSSL store allows for external modifications of the store. For most 1104Linux and BSD distributions, this store is maintained by the distribution 1105maintainers and system administrators. OpenSSL CA store location is dependent on 1106configuration of the OpenSSL library but this can be altered at runtime using 1107environment variables. 1108 1109See `SSL_CERT_DIR` and `SSL_CERT_FILE`. 1110 1111### `--use-largepages=mode` 1112<!-- YAML 1113added: v13.6.0 1114--> 1115 1116Re-map the Node.js static code to large memory pages at startup. If supported on 1117the target system, this will cause the Node.js static code to be moved onto 2 1118MiB pages instead of 4 KiB pages. 1119 1120The following values are valid for `mode`: 1121* `off`: No mapping will be attempted. This is the default. 1122* `on`: If supported by the OS, mapping will be attempted. Failure to map will 1123 be ignored and a message will be printed to standard error. 1124* `silent`: If supported by the OS, mapping will be attempted. Failure to map 1125 will be ignored and will not be reported. 1126 1127### `--v8-options` 1128<!-- YAML 1129added: v0.1.3 1130--> 1131 1132Print V8 command-line options. 1133 1134### `--v8-pool-size=num` 1135<!-- YAML 1136added: v5.10.0 1137--> 1138 1139Set V8's thread pool size which will be used to allocate background jobs. 1140 1141If set to `0` then V8 will choose an appropriate size of the thread pool based 1142on the number of online processors. 1143 1144If the value provided is larger than V8's maximum, then the largest value 1145will be chosen. 1146 1147### `--zero-fill-buffers` 1148<!-- YAML 1149added: v6.0.0 1150--> 1151 1152Automatically zero-fills all newly allocated [`Buffer`][] and [`SlowBuffer`][] 1153instances. 1154 1155### `-c`, `--check` 1156<!-- YAML 1157added: 1158 - v5.0.0 1159 - v4.2.0 1160changes: 1161 - version: v10.0.0 1162 pr-url: https://github.com/nodejs/node/pull/19600 1163 description: The `--require` option is now supported when checking a file. 1164--> 1165 1166Syntax check the script without executing. 1167 1168### `-e`, `--eval "script"` 1169<!-- YAML 1170added: v0.5.2 1171changes: 1172 - version: v5.11.0 1173 pr-url: https://github.com/nodejs/node/pull/5348 1174 description: Built-in libraries are now available as predefined variables. 1175--> 1176 1177Evaluate the following argument as JavaScript. The modules which are 1178predefined in the REPL can also be used in `script`. 1179 1180On Windows, using `cmd.exe` a single quote will not work correctly because it 1181only recognizes double `"` for quoting. In Powershell or Git bash, both `'` 1182and `"` are usable. 1183 1184### `-h`, `--help` 1185<!-- YAML 1186added: v0.1.3 1187--> 1188 1189Print node command-line options. 1190The output of this option is less detailed than this document. 1191 1192### `-i`, `--interactive` 1193<!-- YAML 1194added: v0.7.7 1195--> 1196 1197Opens the REPL even if stdin does not appear to be a terminal. 1198 1199### `-p`, `--print "script"` 1200<!-- YAML 1201added: v0.6.4 1202changes: 1203 - version: v5.11.0 1204 pr-url: https://github.com/nodejs/node/pull/5348 1205 description: Built-in libraries are now available as predefined variables. 1206--> 1207 1208Identical to `-e` but prints the result. 1209 1210### `-r`, `--require module` 1211<!-- YAML 1212added: v1.6.0 1213--> 1214 1215Preload the specified module at startup. 1216 1217Follows `require()`'s module resolution 1218rules. `module` may be either a path to a file, or a node module name. 1219 1220Only CommonJS modules are supported. Attempting to preload a 1221ES6 Module using `--require` will fail with an error. 1222 1223### `-v`, `--version` 1224<!-- YAML 1225added: v0.1.3 1226--> 1227 1228Print node's version. 1229 1230## Environment variables 1231 1232### `FORCE_COLOR=[1, 2, 3]` 1233 1234The `FORCE_COLOR` environment variable is used to 1235enable ANSI colorized output. The value may be: 1236 1237* `1`, `true`, or the empty string `''` indicate 16-color support, 1238* `2` to indicate 256-color support, or 1239* `3` to indicate 16 million-color support. 1240 1241When `FORCE_COLOR` is used and set to a supported value, both the `NO_COLOR`, 1242and `NODE_DISABLE_COLORS` environment variables are ignored. 1243 1244Any other value will result in colorized output being disabled. 1245### `NODE_DEBUG=module[,…]` 1246<!-- YAML 1247added: v0.1.32 1248--> 1249 1250`','`-separated list of core modules that should print debug information. 1251 1252### `NODE_DEBUG_NATIVE=module[,…]` 1253 1254`','`-separated list of core C++ modules that should print debug information. 1255 1256### `NODE_DISABLE_COLORS=1` 1257<!-- YAML 1258added: v0.3.0 1259--> 1260 1261When set, colors will not be used in the REPL. 1262 1263### `NODE_EXTRA_CA_CERTS=file` 1264<!-- YAML 1265added: v7.3.0 1266--> 1267 1268When set, the well known "root" CAs (like VeriSign) will be extended with the 1269extra certificates in `file`. The file should consist of one or more trusted 1270certificates in PEM format. A message will be emitted (once) with 1271[`process.emitWarning()`][emit_warning] if the file is missing or 1272malformed, but any errors are otherwise ignored. 1273 1274Neither the well known nor extra certificates are used when the `ca` 1275options property is explicitly specified for a TLS or HTTPS client or server. 1276 1277This environment variable is ignored when `node` runs as setuid root or 1278has Linux file capabilities set. 1279 1280The `NODE_EXTRA_CA_CERTS` environment variable is only read when the Node.js 1281process is first launched. Changing the value at runtime using 1282`process.env.NODE_EXTRA_CA_CERTS` has no effect on the current process. 1283 1284### `NODE_ICU_DATA=file` 1285<!-- YAML 1286added: v0.11.15 1287--> 1288 1289Data path for ICU (`Intl` object) data. Will extend linked-in data when compiled 1290with small-icu support. 1291 1292### `NODE_NO_WARNINGS=1` 1293<!-- YAML 1294added: v6.11.0 1295--> 1296 1297When set to `1`, process warnings are silenced. 1298 1299### `NODE_OPTIONS=options...` 1300<!-- YAML 1301added: v8.0.0 1302--> 1303 1304A space-separated list of command-line options. `options...` are interpreted 1305before command-line options, so command-line options will override or 1306compound after anything in `options...`. Node.js will exit with an error if 1307an option that is not allowed in the environment is used, such as `-p` or a 1308script file. 1309 1310If an option value contains a space, it can be escaped using double quotes: 1311 1312```bash 1313NODE_OPTIONS='--require "./my path/file.js"' 1314``` 1315 1316A singleton flag passed as a command-line option will override the same flag 1317passed into `NODE_OPTIONS`: 1318 1319```bash 1320# The inspector will be available on port 5555 1321NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555 1322``` 1323 1324A flag that can be passed multiple times will be treated as if its 1325`NODE_OPTIONS` instances were passed first, and then its command-line 1326instances afterwards: 1327 1328```bash 1329NODE_OPTIONS='--require "./a.js"' node --require "./b.js" 1330# is equivalent to: 1331node --require "./a.js" --require "./b.js" 1332``` 1333 1334Node.js options that are allowed are: 1335<!-- node-options-node start --> 1336* `--conditions`, `-C` 1337* `--diagnostic-dir` 1338* `--disable-proto` 1339* `--dns-result-order` 1340* `--enable-fips` 1341* `--enable-source-maps` 1342* `--experimental-abortcontroller` 1343* `--experimental-import-meta-resolve` 1344* `--experimental-json-modules` 1345* `--experimental-loader` 1346* `--experimental-modules` 1347* `--experimental-policy` 1348* `--experimental-repl-await` 1349* `--experimental-specifier-resolution` 1350* `--experimental-top-level-await` 1351* `--experimental-vm-modules` 1352* `--experimental-wasi-unstable-preview1` 1353* `--experimental-wasm-modules` 1354* `--force-context-aware` 1355* `--force-fips` 1356* `--frozen-intrinsics` 1357* `--heapsnapshot-near-heap-limit` 1358* `--heapsnapshot-signal` 1359* `--http-parser` 1360* `--icu-data-dir` 1361* `--input-type` 1362* `--insecure-http-parser` 1363* `--inspect-brk` 1364* `--inspect-port`, `--debug-port` 1365* `--inspect-publish-uid` 1366* `--inspect` 1367* `--max-http-header-size` 1368* `--napi-modules` 1369* `--no-addons` 1370* `--no-deprecation` 1371* `--no-force-async-hooks-checks` 1372* `--no-warnings` 1373* `--node-memory-debug` 1374* `--openssl-config` 1375* `--pending-deprecation` 1376* `--policy-integrity` 1377* `--preserve-symlinks-main` 1378* `--preserve-symlinks` 1379* `--prof-process` 1380* `--redirect-warnings` 1381* `--report-compact` 1382* `--report-dir`, `--report-directory` 1383* `--report-filename` 1384* `--report-on-fatalerror` 1385* `--report-on-signal` 1386* `--report-signal` 1387* `--report-uncaught-exception` 1388* `--require`, `-r` 1389* `--throw-deprecation` 1390* `--title` 1391* `--tls-cipher-list` 1392* `--tls-keylog` 1393* `--tls-max-v1.2` 1394* `--tls-max-v1.3` 1395* `--tls-min-v1.0` 1396* `--tls-min-v1.1` 1397* `--tls-min-v1.2` 1398* `--tls-min-v1.3` 1399* `--trace-atomics-wait` 1400* `--trace-deprecation` 1401* `--trace-event-categories` 1402* `--trace-event-file-pattern` 1403* `--trace-events-enabled` 1404* `--trace-exit` 1405* `--trace-sigint` 1406* `--trace-sync-io` 1407* `--trace-tls` 1408* `--trace-uncaught` 1409* `--trace-warnings` 1410* `--track-heap-objects` 1411* `--unhandled-rejections` 1412* `--use-bundled-ca` 1413* `--use-largepages` 1414* `--use-openssl-ca` 1415* `--v8-pool-size` 1416* `--zero-fill-buffers` 1417<!-- node-options-node end --> 1418 1419V8 options that are allowed are: 1420<!-- node-options-v8 start --> 1421* `--abort-on-uncaught-exception` 1422* `--disallow-code-generation-from-strings` 1423* `--huge-max-old-generation-size` 1424* `--interpreted-frames-native-stack` 1425* `--jitless` 1426* `--max-old-space-size` 1427* `--perf-basic-prof-only-functions` 1428* `--perf-basic-prof` 1429* `--perf-prof-unwinding-info` 1430* `--perf-prof` 1431* `--stack-trace-limit` 1432<!-- node-options-v8 end --> 1433 1434`--perf-basic-prof-only-functions`, `--perf-basic-prof`, 1435`--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux. 1436 1437### `NODE_PATH=path[:…]` 1438<!-- YAML 1439added: v0.1.32 1440--> 1441 1442`':'`-separated list of directories prefixed to the module search path. 1443 1444On Windows, this is a `';'`-separated list instead. 1445 1446### `NODE_PENDING_DEPRECATION=1` 1447<!-- YAML 1448added: v8.0.0 1449--> 1450 1451When set to `1`, emit pending deprecation warnings. 1452 1453Pending deprecations are generally identical to a runtime deprecation with the 1454notable exception that they are turned *off* by default and will not be emitted 1455unless either the `--pending-deprecation` command-line flag, or the 1456`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations 1457are used to provide a kind of selective "early warning" mechanism that 1458developers may leverage to detect deprecated API usage. 1459 1460### `NODE_PENDING_PIPE_INSTANCES=instances` 1461 1462Set the number of pending pipe instance handles when the pipe server is waiting 1463for connections. This setting applies to Windows only. 1464 1465### `NODE_PRESERVE_SYMLINKS=1` 1466<!-- YAML 1467added: v7.1.0 1468--> 1469 1470When set to `1`, instructs the module loader to preserve symbolic links when 1471resolving and caching modules. 1472 1473### `NODE_REDIRECT_WARNINGS=file` 1474<!-- YAML 1475added: v8.0.0 1476--> 1477 1478When set, process warnings will be emitted to the given file instead of 1479printing to stderr. The file will be created if it does not exist, and will be 1480appended to if it does. If an error occurs while attempting to write the 1481warning to the file, the warning will be written to stderr instead. This is 1482equivalent to using the `--redirect-warnings=file` command-line flag. 1483 1484### `NODE_REPL_HISTORY=file` 1485<!-- YAML 1486added: v3.0.0 1487--> 1488 1489Path to the file used to store the persistent REPL history. The default path is 1490`~/.node_repl_history`, which is overridden by this variable. Setting the value 1491to an empty string (`''` or `' '`) disables persistent REPL history. 1492 1493### `NODE_REPL_EXTERNAL_MODULE=file` 1494<!-- YAML 1495added: 1496 - v13.0.0 1497 - v12.16.0 1498--> 1499 1500Path to a Node.js module which will be loaded in place of the built-in REPL. 1501Overriding this value to an empty string (`''`) will use the built-in REPL. 1502 1503### `NODE_SKIP_PLATFORM_CHECK=value` 1504<!-- YAML 1505added: v14.5.0 1506--> 1507 1508If `value` equals `'1'`, the check for a supported platform is skipped during 1509Node.js startup. Node.js might not execute correctly. Any issues encountered 1510on unsupported platforms will not be fixed. 1511 1512### `NODE_TLS_REJECT_UNAUTHORIZED=value` 1513 1514If `value` equals `'0'`, certificate validation is disabled for TLS connections. 1515This makes TLS, and HTTPS by extension, insecure. The use of this environment 1516variable is strongly discouraged. 1517 1518### `NODE_V8_COVERAGE=dir` 1519 1520When set, Node.js will begin outputting [V8 JavaScript code coverage][] and 1521[Source Map][] data to the directory provided as an argument (coverage 1522information is written as JSON to files with a `coverage` prefix). 1523 1524`NODE_V8_COVERAGE` will automatically propagate to subprocesses, making it 1525easier to instrument applications that call the `child_process.spawn()` family 1526of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent 1527propagation. 1528 1529#### Coverage output 1530 1531Coverage is output as an array of [ScriptCoverage][] objects on the top-level 1532key `result`: 1533 1534```json 1535{ 1536 "result": [ 1537 { 1538 "scriptId": "67", 1539 "url": "internal/tty.js", 1540 "functions": [] 1541 } 1542 ] 1543} 1544``` 1545 1546#### Source map cache 1547 1548> Stability: 1 - Experimental 1549 1550If found, source map data is appended to the top-level key `source-map-cache` 1551on the JSON coverage object. 1552 1553`source-map-cache` is an object with keys representing the files source maps 1554were extracted from, and values which include the raw source-map URL 1555(in the key `url`), the parsed Source Map v3 information (in the key `data`), 1556and the line lengths of the source file (in the key `lineLengths`). 1557 1558```json 1559{ 1560 "result": [ 1561 { 1562 "scriptId": "68", 1563 "url": "file:///absolute/path/to/source.js", 1564 "functions": [] 1565 } 1566 ], 1567 "source-map-cache": { 1568 "file:///absolute/path/to/source.js": { 1569 "url": "./path-to-map.json", 1570 "data": { 1571 "version": 3, 1572 "sources": [ 1573 "file:///absolute/path/to/original.js" 1574 ], 1575 "names": [ 1576 "Foo", 1577 "console", 1578 "info" 1579 ], 1580 "mappings": "MAAMA,IACJC,YAAaC", 1581 "sourceRoot": "./" 1582 }, 1583 "lineLengths": [ 1584 13, 1585 62, 1586 38, 1587 27 1588 ] 1589 } 1590 } 1591} 1592``` 1593 1594### `NO_COLOR=<any>` 1595 1596[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the 1597environment variable is arbitrary. 1598 1599### `OPENSSL_CONF=file` 1600<!-- YAML 1601added: v6.11.0 1602--> 1603 1604Load an OpenSSL configuration file on startup. Among other uses, this can be 1605used to enable FIPS-compliant crypto if Node.js is built with `./configure 1606--openssl-fips`. 1607 1608If the [`--openssl-config`][] command-line option is used, the environment 1609variable is ignored. 1610 1611### `SSL_CERT_DIR=dir` 1612<!-- YAML 1613added: v7.7.0 1614--> 1615 1616If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's directory 1617containing trusted certificates. 1618 1619Be aware that unless the child environment is explicitly set, this environment 1620variable will be inherited by any child processes, and if they use OpenSSL, it 1621may cause them to trust the same CAs as node. 1622 1623### `SSL_CERT_FILE=file` 1624<!-- YAML 1625added: v7.7.0 1626--> 1627 1628If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's file 1629containing trusted certificates. 1630 1631Be aware that unless the child environment is explicitly set, this environment 1632variable will be inherited by any child processes, and if they use OpenSSL, it 1633may cause them to trust the same CAs as node. 1634 1635### `UV_THREADPOOL_SIZE=size` 1636 1637Set the number of threads used in libuv's threadpool to `size` threads. 1638 1639Asynchronous system APIs are used by Node.js whenever possible, but where they 1640do not exist, libuv's threadpool is used to create asynchronous node APIs based 1641on synchronous system APIs. Node.js APIs that use the threadpool are: 1642 1643* all `fs` APIs, other than the file watcher APIs and those that are explicitly 1644 synchronous 1645* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, 1646 `crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()` 1647* `dns.lookup()` 1648* all `zlib` APIs, other than those that are explicitly synchronous 1649 1650Because libuv's threadpool has a fixed size, it means that if for whatever 1651reason any of these APIs takes a long time, other (seemingly unrelated) APIs 1652that run in libuv's threadpool will experience degraded performance. In order to 1653mitigate this issue, one potential solution is to increase the size of libuv's 1654threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value 1655greater than `4` (its current default value). For more information, see the 1656[libuv threadpool documentation][]. 1657 1658## Useful V8 options 1659 1660V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` 1661will be passed on to V8 to handle. V8's options have _no stability guarantee_. 1662The V8 team themselves don't consider them to be part of their formal API, 1663and reserve the right to change them at any time. Likewise, they are not 1664covered by the Node.js stability guarantees. Many of the V8 1665options are of interest only to V8 developers. Despite this, there is a small 1666set of V8 options that are widely applicable to Node.js, and they are 1667documented here: 1668 1669### `--max-old-space-size=SIZE` (in megabytes) 1670 1671Sets the max memory size of V8's old memory section. As memory 1672consumption approaches the limit, V8 will spend more time on 1673garbage collection in an effort to free unused memory. 1674 1675On a machine with 2GB of memory, consider setting this to 16761536 (1.5GB) to leave some memory for other uses and avoid swapping. 1677 1678```console 1679$ node --max-old-space-size=1536 index.js 1680``` 1681 1682[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ 1683[ECMAScript Module loader]: esm.md#esm_loaders 1684[REPL]: repl.md 1685[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage 1686[Source Map]: https://sourcemaps.info/spec.html 1687[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity 1688[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html 1689[`--openssl-config`]: #cli_openssl_config_file 1690[`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait 1691[`Buffer`]: buffer.md#buffer_class_buffer 1692[`NODE_OPTIONS`]: #cli_node_options_options 1693[`NO_COLOR`]: https://no-color.org 1694[`SlowBuffer`]: buffer.md#buffer_class_slowbuffer 1695[`dns.lookup()`]: dns.md#dns_dns_lookup_hostname_options_callback 1696[`dns.setDefaultResultOrder()`]: dns.md#dns_dns_setdefaultresultorder_order 1697[`dnsPromises.lookup()`]: dns.md#dns_dnspromises_lookup_hostname_options 1698[`process.setUncaughtExceptionCaptureCallback()`]: process.md#process_process_setuncaughtexceptioncapturecallback_fn 1699[`tls.DEFAULT_MAX_VERSION`]: tls.md#tls_tls_default_max_version 1700[`tls.DEFAULT_MIN_VERSION`]: tls.md#tls_tls_default_min_version 1701[`unhandledRejection`]: process.md#process_event_unhandledrejection 1702[`worker_threads.threadId`]: worker_threads.md#worker_threads_worker_threadid 1703[conditional exports]: packages.md#packages_conditional_exports 1704[context-aware]: addons.md#addons_context_aware_addons 1705[customizing ESM specifier resolution]: esm.md#esm_customizing_esm_specifier_resolution_algorithm 1706[debugger]: debugger.md 1707[debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications 1708[emit_warning]: process.md#process_process_emitwarning_warning_type_code_ctor 1709[jitless]: https://v8.dev/blog/jitless 1710[libuv threadpool documentation]: https://docs.libuv.org/en/latest/threadpool.html 1711[remote code execution]: https://www.owasp.org/index.php/Code_Injection 1712