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### `--openssl-shared-config` 639 640<!-- YAML 641added: v14.21.0 642--> 643 644Enable OpenSSL default configuration section, `openssl_conf` to be read from 645the OpenSSL configuration file. The default configuration file is named 646`openssl.cnf` but this can be changed using the environment variable 647`OPENSSL_CONF`, or by using the command line option `--openssl-config`. 648The location of the default OpenSSL configuration file depends on how OpenSSL 649is being linked to Node.js. Sharing the OpenSSL configuration may have unwanted 650implications and it is recommended to use a configuration section specific to 651Node.js which is `nodejs_conf` and is default when this option is not used. 652 653### `--pending-deprecation` 654<!-- YAML 655added: v8.0.0 656--> 657 658Emit pending deprecation warnings. 659 660Pending deprecations are generally identical to a runtime deprecation with the 661notable exception that they are turned *off* by default and will not be emitted 662unless either the `--pending-deprecation` command-line flag, or the 663`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations 664are used to provide a kind of selective "early warning" mechanism that 665developers may leverage to detect deprecated API usage. 666 667### `--policy-integrity=sri` 668<!-- YAML 669added: v12.7.0 670--> 671 672> Stability: 1 - Experimental 673 674Instructs Node.js to error prior to running any code if the policy does not have 675the specified integrity. It expects a [Subresource Integrity][] string as a 676parameter. 677 678### `--preserve-symlinks` 679<!-- YAML 680added: v6.3.0 681--> 682 683Instructs the module loader to preserve symbolic links when resolving and 684caching modules. 685 686By default, when Node.js loads a module from a path that is symbolically linked 687to a different on-disk location, Node.js will dereference the link and use the 688actual on-disk "real path" of the module as both an identifier and as a root 689path to locate other dependency modules. In most cases, this default behavior 690is acceptable. However, when using symbolically linked peer dependencies, as 691illustrated in the example below, the default behavior causes an exception to 692be thrown if `moduleA` attempts to require `moduleB` as a peer dependency: 693 694```text 695{appDir} 696 ├── app 697 │ ├── index.js 698 │ └── node_modules 699 │ ├── moduleA -> {appDir}/moduleA 700 │ └── moduleB 701 │ ├── index.js 702 │ └── package.json 703 └── moduleA 704 ├── index.js 705 └── package.json 706``` 707 708The `--preserve-symlinks` command-line flag instructs Node.js to use the 709symlink path for modules as opposed to the real path, allowing symbolically 710linked peer dependencies to be found. 711 712Note, however, that using `--preserve-symlinks` can have other side effects. 713Specifically, symbolically linked *native* modules can fail to load if those 714are linked from more than one location in the dependency tree (Node.js would 715see those as two separate modules and would attempt to load the module multiple 716times, causing an exception to be thrown). 717 718The `--preserve-symlinks` flag does not apply to the main module, which allows 719`node --preserve-symlinks node_module/.bin/<foo>` to work. To apply the same 720behavior for the main module, also use `--preserve-symlinks-main`. 721 722### `--preserve-symlinks-main` 723<!-- YAML 724added: v10.2.0 725--> 726 727Instructs the module loader to preserve symbolic links when resolving and 728caching the main module (`require.main`). 729 730This flag exists so that the main module can be opted-in to the same behavior 731that `--preserve-symlinks` gives to all other imports; they are separate flags, 732however, for backward compatibility with older Node.js versions. 733 734`--preserve-symlinks-main` does not imply `--preserve-symlinks`; use 735`--preserve-symlinks-main` in addition to 736`--preserve-symlinks` when it is not desirable to follow symlinks before 737resolving relative paths. 738 739See `--preserve-symlinks` for more information. 740 741### `--prof` 742<!-- YAML 743added: v2.0.0 744--> 745 746Generate V8 profiler output. 747 748### `--prof-process` 749<!-- YAML 750added: v5.2.0 751--> 752 753Process V8 profiler output generated using the V8 option `--prof`. 754 755### `--redirect-warnings=file` 756<!-- YAML 757added: v8.0.0 758--> 759 760Write process warnings to the given file instead of printing to stderr. The 761file will be created if it does not exist, and will be appended to if it does. 762If an error occurs while attempting to write the warning to the file, the 763warning will be written to stderr instead. 764 765The `file` name may be an absolute path. If it is not, the default directory it 766will be written to is controlled by the 767[--diagnostic-dir](#cli_diagnostic_dir_directory) command-line option. 768 769### `--report-compact` 770<!-- YAML 771added: v13.12.0 772--> 773 774Write reports in a compact format, single-line JSON, more easily consumable 775by log processing systems than the default multi-line format designed for 776human consumption. 777 778### `--report-dir=directory`, `report-directory=directory` 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-directory` to 788 `--report-directory`. 789--> 790 791Location at which the report will be generated. 792 793### `--report-filename=filename` 794<!-- YAML 795added: v11.8.0 796changes: 797 - version: v13.12.0 798 pr-url: https://github.com/nodejs/node/pull/32242 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-filename` to 803 `--report-filename`. 804--> 805 806Name of the file to which the report will be written. 807 808### `--report-on-fatalerror` 809<!-- YAML 810added: v11.8.0 811changes: 812 - version: v14.0.0 813 pr-url: https://github.com/nodejs/node/pull/32496 814 description: This option is no longer experimental. 815 - version: v12.0.0 816 pr-url: https://github.com/nodejs/node/pull/27312 817 description: changed from `--diagnostic-report-on-fatalerror` to 818 `--report-on-fatalerror`. 819--> 820 821Enables the report to be triggered on fatal errors (internal errors within 822the Node.js runtime such as out of memory) that lead to termination of the 823application. Useful to inspect various diagnostic data elements such as heap, 824stack, event loop state, resource consumption etc. to reason about the fatal 825error. 826 827### `--report-on-signal` 828<!-- YAML 829added: v11.8.0 830changes: 831 - version: v13.12.0 832 pr-url: https://github.com/nodejs/node/pull/32242 833 description: This option is no longer experimental. 834 - version: v12.0.0 835 pr-url: https://github.com/nodejs/node/pull/27312 836 description: changed from `--diagnostic-report-on-signal` to 837 `--report-on-signal`. 838--> 839 840Enables report to be generated upon receiving the specified (or predefined) 841signal to the running Node.js process. The signal to trigger the report is 842specified through `--report-signal`. 843 844### `--report-signal=signal` 845<!-- YAML 846added: v11.8.0 847changes: 848 - version: v13.12.0 849 pr-url: https://github.com/nodejs/node/pull/32242 850 description: This option is no longer experimental. 851 - version: v12.0.0 852 pr-url: https://github.com/nodejs/node/pull/27312 853 description: changed from `--diagnostic-report-signal` to 854 `--report-signal`. 855--> 856 857Sets or resets the signal for report generation (not supported on Windows). 858Default signal is `SIGUSR2`. 859 860### `--report-uncaught-exception` 861<!-- YAML 862added: v11.8.0 863changes: 864 - version: v13.12.0 865 pr-url: https://github.com/nodejs/node/pull/32242 866 description: This option is no longer experimental. 867 - version: v12.0.0 868 pr-url: https://github.com/nodejs/node/pull/27312 869 description: changed from `--diagnostic-report-uncaught-exception` to 870 `--report-uncaught-exception`. 871--> 872 873Enables report to be generated on uncaught exceptions. Useful when inspecting 874the JavaScript stack in conjunction with native stack and other runtime 875environment data. 876 877### `--throw-deprecation` 878<!-- YAML 879added: v0.11.14 880--> 881 882Throw errors for deprecations. 883 884### `--title=title` 885<!-- YAML 886added: v10.7.0 887--> 888 889Set `process.title` on startup. 890 891### `--tls-cipher-list=list` 892<!-- YAML 893added: v4.0.0 894--> 895 896Specify an alternative default TLS cipher list. Requires Node.js to be built 897with crypto support (default). 898 899### `--tls-keylog=file` 900<!-- YAML 901added: 902 - v13.2.0 903 - v12.16.0 904--> 905 906Log TLS key material to a file. The key material is in NSS `SSLKEYLOGFILE` 907format and can be used by software (such as Wireshark) to decrypt the TLS 908traffic. 909 910### `--tls-max-v1.2` 911<!-- YAML 912added: 913 - v12.0.0 914 - v10.20.0 915--> 916 917Set [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.2'. Use to disable support for 918TLSv1.3. 919 920### `--tls-max-v1.3` 921<!-- YAML 922added: v12.0.0 923--> 924 925Set default [`tls.DEFAULT_MAX_VERSION`][] to 'TLSv1.3'. Use to enable support 926for TLSv1.3. 927 928### `--tls-min-v1.0` 929<!-- YAML 930added: 931 - v12.0.0 932 - v10.20.0 933--> 934 935Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1'. Use for compatibility with 936old TLS clients or servers. 937 938### `--tls-min-v1.1` 939<!-- YAML 940added: 941 - v12.0.0 942 - v10.20.0 943--> 944 945Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.1'. Use for compatibility 946with old TLS clients or servers. 947 948### `--tls-min-v1.2` 949<!-- YAML 950added: 951 - v12.2.0 952 - v10.20.0 953--> 954 955Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.2'. This is the default for 95612.x and later, but the option is supported for compatibility with older Node.js 957versions. 958 959### `--tls-min-v1.3` 960<!-- YAML 961added: v12.0.0 962--> 963 964Set default [`tls.DEFAULT_MIN_VERSION`][] to 'TLSv1.3'. Use to disable support 965for TLSv1.2, which is not as secure as TLSv1.3. 966 967### `--trace-atomics-wait` 968<!-- YAML 969added: v14.3.0 970--> 971 972Print short summaries of calls to [`Atomics.wait()`][] to stderr. 973The output could look like this: 974 975```text 976(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) started 977(node:15701) [Thread 0] Atomics.wait(<address> + 0, 1, inf) did not wait because the values mismatched 978(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) started 979(node:15701) [Thread 0] Atomics.wait(<address> + 0, 0, 10) timed out 980(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) started 981(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) started 982(node:15701) [Thread 0] Atomics.wait(<address> + 4, 0, inf) was woken up by another thread 983(node:15701) [Thread 1] Atomics.wait(<address> + 4, -1, inf) was woken up by another thread 984``` 985 986The fields here correspond to: 987 988* The thread id as given by [`worker_threads.threadId`][] 989* The base address of the `SharedArrayBuffer` in question, as well as the 990 byte offset corresponding to the index passed to `Atomics.wait()` 991* The expected value that was passed to `Atomics.wait()` 992* The timeout passed to `Atomics.wait` 993 994### `--trace-deprecation` 995<!-- YAML 996added: v0.8.0 997--> 998 999Print stack traces for deprecations. 1000 1001### `--trace-event-categories` 1002<!-- YAML 1003added: v7.7.0 1004--> 1005 1006A comma separated list of categories that should be traced when trace event 1007tracing is enabled using `--trace-events-enabled`. 1008 1009### `--trace-event-file-pattern` 1010<!-- YAML 1011added: v9.8.0 1012--> 1013 1014Template string specifying the filepath for the trace event data, it 1015supports `${rotation}` and `${pid}`. 1016 1017### `--trace-events-enabled` 1018<!-- YAML 1019added: v7.7.0 1020--> 1021 1022Enables the collection of trace event tracing information. 1023 1024### `--trace-exit` 1025<!-- YAML 1026added: 1027 - v13.5.0 1028 - v12.16.0 1029--> 1030 1031Prints a stack trace whenever an environment is exited proactively, 1032i.e. invoking `process.exit()`. 1033 1034### `--trace-sigint` 1035<!-- YAML 1036added: v13.9.0 1037--> 1038 1039Prints a stack trace on SIGINT. 1040 1041### `--trace-sync-io` 1042<!-- YAML 1043added: v2.1.0 1044--> 1045 1046Prints a stack trace whenever synchronous I/O is detected after the first turn 1047of the event loop. 1048 1049### `--trace-tls` 1050<!-- YAML 1051added: v12.2.0 1052--> 1053 1054Prints TLS packet trace information to `stderr`. This can be used to debug TLS 1055connection problems. 1056 1057### `--trace-uncaught` 1058<!-- YAML 1059added: v13.1.0 1060--> 1061 1062Print stack traces for uncaught exceptions; usually, the stack trace associated 1063with the creation of an `Error` is printed, whereas this makes Node.js also 1064print the stack trace associated with throwing the value (which does not need 1065to be an `Error` instance). 1066 1067Enabling this option may affect garbage collection behavior negatively. 1068 1069### `--trace-warnings` 1070<!-- YAML 1071added: v6.0.0 1072--> 1073 1074Print stack traces for process warnings (including deprecations). 1075 1076### `--track-heap-objects` 1077<!-- YAML 1078added: v2.4.0 1079--> 1080 1081Track heap object allocations for heap snapshots. 1082 1083### `--unhandled-rejections=mode` 1084<!-- YAML 1085added: 1086 - v12.0.0 1087 - v10.17.0 1088--> 1089 1090By default all unhandled rejections trigger a warning plus a deprecation warning 1091for the very first unhandled rejection in case no [`unhandledRejection`][] hook 1092is used. 1093 1094Using this flag allows to change what should happen when an unhandled rejection 1095occurs. One of the following modes can be chosen: 1096 1097* `throw`: Emit [`unhandledRejection`][]. If this hook is not set, raise the 1098 unhandled rejection as an uncaught exception. 1099* `strict`: Raise the unhandled rejection as an uncaught exception. 1100* `warn`: Always trigger a warning, no matter if the [`unhandledRejection`][] 1101 hook is set or not but do not print the deprecation warning. 1102* `warn-with-error-code`: Emit [`unhandledRejection`][]. If this hook is not 1103 set, trigger a warning, and set the process exit code to 1. 1104* `none`: Silence all warnings. 1105 1106### `--use-bundled-ca`, `--use-openssl-ca` 1107<!-- YAML 1108added: v6.11.0 1109--> 1110 1111Use bundled Mozilla CA store as supplied by current Node.js version 1112or use OpenSSL's default CA store. The default store is selectable 1113at build-time. 1114 1115The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store 1116that is fixed at release time. It is identical on all supported platforms. 1117 1118Using OpenSSL store allows for external modifications of the store. For most 1119Linux and BSD distributions, this store is maintained by the distribution 1120maintainers and system administrators. OpenSSL CA store location is dependent on 1121configuration of the OpenSSL library but this can be altered at runtime using 1122environment variables. 1123 1124See `SSL_CERT_DIR` and `SSL_CERT_FILE`. 1125 1126### `--use-largepages=mode` 1127<!-- YAML 1128added: v13.6.0 1129--> 1130 1131Re-map the Node.js static code to large memory pages at startup. If supported on 1132the target system, this will cause the Node.js static code to be moved onto 2 1133MiB pages instead of 4 KiB pages. 1134 1135The following values are valid for `mode`: 1136* `off`: No mapping will be attempted. This is the default. 1137* `on`: If supported by the OS, mapping will be attempted. Failure to map will 1138 be ignored and a message will be printed to standard error. 1139* `silent`: If supported by the OS, mapping will be attempted. Failure to map 1140 will be ignored and will not be reported. 1141 1142### `--v8-options` 1143<!-- YAML 1144added: v0.1.3 1145--> 1146 1147Print V8 command-line options. 1148 1149### `--v8-pool-size=num` 1150<!-- YAML 1151added: v5.10.0 1152--> 1153 1154Set V8's thread pool size which will be used to allocate background jobs. 1155 1156If set to `0` then V8 will choose an appropriate size of the thread pool based 1157on the number of online processors. 1158 1159If the value provided is larger than V8's maximum, then the largest value 1160will be chosen. 1161 1162### `--zero-fill-buffers` 1163<!-- YAML 1164added: v6.0.0 1165--> 1166 1167Automatically zero-fills all newly allocated [`Buffer`][] and [`SlowBuffer`][] 1168instances. 1169 1170### `-c`, `--check` 1171<!-- YAML 1172added: 1173 - v5.0.0 1174 - v4.2.0 1175changes: 1176 - version: v10.0.0 1177 pr-url: https://github.com/nodejs/node/pull/19600 1178 description: The `--require` option is now supported when checking a file. 1179--> 1180 1181Syntax check the script without executing. 1182 1183### `-e`, `--eval "script"` 1184<!-- YAML 1185added: v0.5.2 1186changes: 1187 - version: v5.11.0 1188 pr-url: https://github.com/nodejs/node/pull/5348 1189 description: Built-in libraries are now available as predefined variables. 1190--> 1191 1192Evaluate the following argument as JavaScript. The modules which are 1193predefined in the REPL can also be used in `script`. 1194 1195On Windows, using `cmd.exe` a single quote will not work correctly because it 1196only recognizes double `"` for quoting. In Powershell or Git bash, both `'` 1197and `"` are usable. 1198 1199### `-h`, `--help` 1200<!-- YAML 1201added: v0.1.3 1202--> 1203 1204Print node command-line options. 1205The output of this option is less detailed than this document. 1206 1207### `-i`, `--interactive` 1208<!-- YAML 1209added: v0.7.7 1210--> 1211 1212Opens the REPL even if stdin does not appear to be a terminal. 1213 1214### `-p`, `--print "script"` 1215<!-- YAML 1216added: v0.6.4 1217changes: 1218 - version: v5.11.0 1219 pr-url: https://github.com/nodejs/node/pull/5348 1220 description: Built-in libraries are now available as predefined variables. 1221--> 1222 1223Identical to `-e` but prints the result. 1224 1225### `-r`, `--require module` 1226<!-- YAML 1227added: v1.6.0 1228--> 1229 1230Preload the specified module at startup. 1231 1232Follows `require()`'s module resolution 1233rules. `module` may be either a path to a file, or a node module name. 1234 1235Only CommonJS modules are supported. Attempting to preload a 1236ES6 Module using `--require` will fail with an error. 1237 1238### `-v`, `--version` 1239<!-- YAML 1240added: v0.1.3 1241--> 1242 1243Print node's version. 1244 1245## Environment variables 1246 1247### `FORCE_COLOR=[1, 2, 3]` 1248 1249The `FORCE_COLOR` environment variable is used to 1250enable ANSI colorized output. The value may be: 1251 1252* `1`, `true`, or the empty string `''` indicate 16-color support, 1253* `2` to indicate 256-color support, or 1254* `3` to indicate 16 million-color support. 1255 1256When `FORCE_COLOR` is used and set to a supported value, both the `NO_COLOR`, 1257and `NODE_DISABLE_COLORS` environment variables are ignored. 1258 1259Any other value will result in colorized output being disabled. 1260### `NODE_DEBUG=module[,…]` 1261<!-- YAML 1262added: v0.1.32 1263--> 1264 1265`','`-separated list of core modules that should print debug information. 1266 1267### `NODE_DEBUG_NATIVE=module[,…]` 1268 1269`','`-separated list of core C++ modules that should print debug information. 1270 1271### `NODE_DISABLE_COLORS=1` 1272<!-- YAML 1273added: v0.3.0 1274--> 1275 1276When set, colors will not be used in the REPL. 1277 1278### `NODE_EXTRA_CA_CERTS=file` 1279<!-- YAML 1280added: v7.3.0 1281--> 1282 1283When set, the well known "root" CAs (like VeriSign) will be extended with the 1284extra certificates in `file`. The file should consist of one or more trusted 1285certificates in PEM format. A message will be emitted (once) with 1286[`process.emitWarning()`][emit_warning] if the file is missing or 1287malformed, but any errors are otherwise ignored. 1288 1289Neither the well known nor extra certificates are used when the `ca` 1290options property is explicitly specified for a TLS or HTTPS client or server. 1291 1292This environment variable is ignored when `node` runs as setuid root or 1293has Linux file capabilities set. 1294 1295The `NODE_EXTRA_CA_CERTS` environment variable is only read when the Node.js 1296process is first launched. Changing the value at runtime using 1297`process.env.NODE_EXTRA_CA_CERTS` has no effect on the current process. 1298 1299### `NODE_ICU_DATA=file` 1300<!-- YAML 1301added: v0.11.15 1302--> 1303 1304Data path for ICU (`Intl` object) data. Will extend linked-in data when compiled 1305with small-icu support. 1306 1307### `NODE_NO_WARNINGS=1` 1308<!-- YAML 1309added: v6.11.0 1310--> 1311 1312When set to `1`, process warnings are silenced. 1313 1314### `NODE_OPTIONS=options...` 1315<!-- YAML 1316added: v8.0.0 1317--> 1318 1319A space-separated list of command-line options. `options...` are interpreted 1320before command-line options, so command-line options will override or 1321compound after anything in `options...`. Node.js will exit with an error if 1322an option that is not allowed in the environment is used, such as `-p` or a 1323script file. 1324 1325If an option value contains a space, it can be escaped using double quotes: 1326 1327```bash 1328NODE_OPTIONS='--require "./my path/file.js"' 1329``` 1330 1331A singleton flag passed as a command-line option will override the same flag 1332passed into `NODE_OPTIONS`: 1333 1334```bash 1335# The inspector will be available on port 5555 1336NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555 1337``` 1338 1339A flag that can be passed multiple times will be treated as if its 1340`NODE_OPTIONS` instances were passed first, and then its command-line 1341instances afterwards: 1342 1343```bash 1344NODE_OPTIONS='--require "./a.js"' node --require "./b.js" 1345# is equivalent to: 1346node --require "./a.js" --require "./b.js" 1347``` 1348 1349Node.js options that are allowed are: 1350<!-- node-options-node start --> 1351* `--conditions`, `-C` 1352* `--diagnostic-dir` 1353* `--disable-proto` 1354* `--dns-result-order` 1355* `--enable-fips` 1356* `--enable-source-maps` 1357* `--experimental-abortcontroller` 1358* `--experimental-import-meta-resolve` 1359* `--experimental-json-modules` 1360* `--experimental-loader` 1361* `--experimental-modules` 1362* `--experimental-policy` 1363* `--experimental-repl-await` 1364* `--experimental-specifier-resolution` 1365* `--experimental-top-level-await` 1366* `--experimental-vm-modules` 1367* `--experimental-wasi-unstable-preview1` 1368* `--experimental-wasm-modules` 1369* `--force-context-aware` 1370* `--force-fips` 1371* `--frozen-intrinsics` 1372* `--heapsnapshot-near-heap-limit` 1373* `--heapsnapshot-signal` 1374* `--http-parser` 1375* `--icu-data-dir` 1376* `--input-type` 1377* `--insecure-http-parser` 1378* `--inspect-brk` 1379* `--inspect-port`, `--debug-port` 1380* `--inspect-publish-uid` 1381* `--inspect` 1382* `--max-http-header-size` 1383* `--napi-modules` 1384* `--no-addons` 1385* `--no-deprecation` 1386* `--no-force-async-hooks-checks` 1387* `--no-warnings` 1388* `--node-memory-debug` 1389* `--openssl-config` 1390* `--openssl-shared-config` 1391* `--pending-deprecation` 1392* `--policy-integrity` 1393* `--preserve-symlinks-main` 1394* `--preserve-symlinks` 1395* `--prof-process` 1396* `--redirect-warnings` 1397* `--report-compact` 1398* `--report-dir`, `--report-directory` 1399* `--report-filename` 1400* `--report-on-fatalerror` 1401* `--report-on-signal` 1402* `--report-signal` 1403* `--report-uncaught-exception` 1404* `--require`, `-r` 1405* `--throw-deprecation` 1406* `--title` 1407* `--tls-cipher-list` 1408* `--tls-keylog` 1409* `--tls-max-v1.2` 1410* `--tls-max-v1.3` 1411* `--tls-min-v1.0` 1412* `--tls-min-v1.1` 1413* `--tls-min-v1.2` 1414* `--tls-min-v1.3` 1415* `--trace-atomics-wait` 1416* `--trace-deprecation` 1417* `--trace-event-categories` 1418* `--trace-event-file-pattern` 1419* `--trace-events-enabled` 1420* `--trace-exit` 1421* `--trace-sigint` 1422* `--trace-sync-io` 1423* `--trace-tls` 1424* `--trace-uncaught` 1425* `--trace-warnings` 1426* `--track-heap-objects` 1427* `--unhandled-rejections` 1428* `--use-bundled-ca` 1429* `--use-largepages` 1430* `--use-openssl-ca` 1431* `--v8-pool-size` 1432* `--zero-fill-buffers` 1433<!-- node-options-node end --> 1434 1435V8 options that are allowed are: 1436<!-- node-options-v8 start --> 1437* `--abort-on-uncaught-exception` 1438* `--disallow-code-generation-from-strings` 1439* `--huge-max-old-generation-size` 1440* `--interpreted-frames-native-stack` 1441* `--jitless` 1442* `--max-old-space-size` 1443* `--perf-basic-prof-only-functions` 1444* `--perf-basic-prof` 1445* `--perf-prof-unwinding-info` 1446* `--perf-prof` 1447* `--stack-trace-limit` 1448<!-- node-options-v8 end --> 1449 1450`--perf-basic-prof-only-functions`, `--perf-basic-prof`, 1451`--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux. 1452 1453### `NODE_PATH=path[:…]` 1454<!-- YAML 1455added: v0.1.32 1456--> 1457 1458`':'`-separated list of directories prefixed to the module search path. 1459 1460On Windows, this is a `';'`-separated list instead. 1461 1462### `NODE_PENDING_DEPRECATION=1` 1463<!-- YAML 1464added: v8.0.0 1465--> 1466 1467When set to `1`, emit pending deprecation warnings. 1468 1469Pending deprecations are generally identical to a runtime deprecation with the 1470notable exception that they are turned *off* by default and will not be emitted 1471unless either the `--pending-deprecation` command-line flag, or the 1472`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations 1473are used to provide a kind of selective "early warning" mechanism that 1474developers may leverage to detect deprecated API usage. 1475 1476### `NODE_PENDING_PIPE_INSTANCES=instances` 1477 1478Set the number of pending pipe instance handles when the pipe server is waiting 1479for connections. This setting applies to Windows only. 1480 1481### `NODE_PRESERVE_SYMLINKS=1` 1482<!-- YAML 1483added: v7.1.0 1484--> 1485 1486When set to `1`, instructs the module loader to preserve symbolic links when 1487resolving and caching modules. 1488 1489### `NODE_REDIRECT_WARNINGS=file` 1490<!-- YAML 1491added: v8.0.0 1492--> 1493 1494When set, process warnings will be emitted to the given file instead of 1495printing to stderr. The file will be created if it does not exist, and will be 1496appended to if it does. If an error occurs while attempting to write the 1497warning to the file, the warning will be written to stderr instead. This is 1498equivalent to using the `--redirect-warnings=file` command-line flag. 1499 1500### `NODE_REPL_HISTORY=file` 1501<!-- YAML 1502added: v3.0.0 1503--> 1504 1505Path to the file used to store the persistent REPL history. The default path is 1506`~/.node_repl_history`, which is overridden by this variable. Setting the value 1507to an empty string (`''` or `' '`) disables persistent REPL history. 1508 1509### `NODE_REPL_EXTERNAL_MODULE=file` 1510<!-- YAML 1511added: 1512 - v13.0.0 1513 - v12.16.0 1514--> 1515 1516Path to a Node.js module which will be loaded in place of the built-in REPL. 1517Overriding this value to an empty string (`''`) will use the built-in REPL. 1518 1519### `NODE_SKIP_PLATFORM_CHECK=value` 1520<!-- YAML 1521added: v14.5.0 1522--> 1523 1524If `value` equals `'1'`, the check for a supported platform is skipped during 1525Node.js startup. Node.js might not execute correctly. Any issues encountered 1526on unsupported platforms will not be fixed. 1527 1528### `NODE_TLS_REJECT_UNAUTHORIZED=value` 1529 1530If `value` equals `'0'`, certificate validation is disabled for TLS connections. 1531This makes TLS, and HTTPS by extension, insecure. The use of this environment 1532variable is strongly discouraged. 1533 1534### `NODE_V8_COVERAGE=dir` 1535 1536When set, Node.js will begin outputting [V8 JavaScript code coverage][] and 1537[Source Map][] data to the directory provided as an argument (coverage 1538information is written as JSON to files with a `coverage` prefix). 1539 1540`NODE_V8_COVERAGE` will automatically propagate to subprocesses, making it 1541easier to instrument applications that call the `child_process.spawn()` family 1542of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent 1543propagation. 1544 1545#### Coverage output 1546 1547Coverage is output as an array of [ScriptCoverage][] objects on the top-level 1548key `result`: 1549 1550```json 1551{ 1552 "result": [ 1553 { 1554 "scriptId": "67", 1555 "url": "internal/tty.js", 1556 "functions": [] 1557 } 1558 ] 1559} 1560``` 1561 1562#### Source map cache 1563 1564> Stability: 1 - Experimental 1565 1566If found, source map data is appended to the top-level key `source-map-cache` 1567on the JSON coverage object. 1568 1569`source-map-cache` is an object with keys representing the files source maps 1570were extracted from, and values which include the raw source-map URL 1571(in the key `url`), the parsed Source Map v3 information (in the key `data`), 1572and the line lengths of the source file (in the key `lineLengths`). 1573 1574```json 1575{ 1576 "result": [ 1577 { 1578 "scriptId": "68", 1579 "url": "file:///absolute/path/to/source.js", 1580 "functions": [] 1581 } 1582 ], 1583 "source-map-cache": { 1584 "file:///absolute/path/to/source.js": { 1585 "url": "./path-to-map.json", 1586 "data": { 1587 "version": 3, 1588 "sources": [ 1589 "file:///absolute/path/to/original.js" 1590 ], 1591 "names": [ 1592 "Foo", 1593 "console", 1594 "info" 1595 ], 1596 "mappings": "MAAMA,IACJC,YAAaC", 1597 "sourceRoot": "./" 1598 }, 1599 "lineLengths": [ 1600 13, 1601 62, 1602 38, 1603 27 1604 ] 1605 } 1606 } 1607} 1608``` 1609 1610### `NO_COLOR=<any>` 1611 1612[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the 1613environment variable is arbitrary. 1614 1615### `OPENSSL_CONF=file` 1616<!-- YAML 1617added: v6.11.0 1618--> 1619 1620Load an OpenSSL configuration file on startup. Among other uses, this can be 1621used to enable FIPS-compliant crypto if Node.js is built with `./configure 1622--openssl-fips`. 1623 1624If the [`--openssl-config`][] command-line option is used, the environment 1625variable is ignored. 1626 1627### `SSL_CERT_DIR=dir` 1628<!-- YAML 1629added: v7.7.0 1630--> 1631 1632If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's directory 1633containing trusted certificates. 1634 1635Be aware that unless the child environment is explicitly set, this environment 1636variable will be inherited by any child processes, and if they use OpenSSL, it 1637may cause them to trust the same CAs as node. 1638 1639### `SSL_CERT_FILE=file` 1640<!-- YAML 1641added: v7.7.0 1642--> 1643 1644If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's file 1645containing trusted certificates. 1646 1647Be aware that unless the child environment is explicitly set, this environment 1648variable will be inherited by any child processes, and if they use OpenSSL, it 1649may cause them to trust the same CAs as node. 1650 1651### `UV_THREADPOOL_SIZE=size` 1652 1653Set the number of threads used in libuv's threadpool to `size` threads. 1654 1655Asynchronous system APIs are used by Node.js whenever possible, but where they 1656do not exist, libuv's threadpool is used to create asynchronous node APIs based 1657on synchronous system APIs. Node.js APIs that use the threadpool are: 1658 1659* all `fs` APIs, other than the file watcher APIs and those that are explicitly 1660 synchronous 1661* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, 1662 `crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()` 1663* `dns.lookup()` 1664* all `zlib` APIs, other than those that are explicitly synchronous 1665 1666Because libuv's threadpool has a fixed size, it means that if for whatever 1667reason any of these APIs takes a long time, other (seemingly unrelated) APIs 1668that run in libuv's threadpool will experience degraded performance. In order to 1669mitigate this issue, one potential solution is to increase the size of libuv's 1670threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value 1671greater than `4` (its current default value). For more information, see the 1672[libuv threadpool documentation][]. 1673 1674## Useful V8 options 1675 1676V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` 1677will be passed on to V8 to handle. V8's options have _no stability guarantee_. 1678The V8 team themselves don't consider them to be part of their formal API, 1679and reserve the right to change them at any time. Likewise, they are not 1680covered by the Node.js stability guarantees. Many of the V8 1681options are of interest only to V8 developers. Despite this, there is a small 1682set of V8 options that are widely applicable to Node.js, and they are 1683documented here: 1684 1685### `--max-old-space-size=SIZE` (in megabytes) 1686 1687Sets the max memory size of V8's old memory section. As memory 1688consumption approaches the limit, V8 will spend more time on 1689garbage collection in an effort to free unused memory. 1690 1691On a machine with 2GB of memory, consider setting this to 16921536 (1.5GB) to leave some memory for other uses and avoid swapping. 1693 1694```console 1695$ node --max-old-space-size=1536 index.js 1696``` 1697 1698[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ 1699[ECMAScript Module loader]: esm.md#esm_loaders 1700[REPL]: repl.md 1701[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage 1702[Source Map]: https://sourcemaps.info/spec.html 1703[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity 1704[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html 1705[`--openssl-config`]: #cli_openssl_config_file 1706[`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait 1707[`Buffer`]: buffer.md#buffer_class_buffer 1708[`NODE_OPTIONS`]: #cli_node_options_options 1709[`NO_COLOR`]: https://no-color.org 1710[`SlowBuffer`]: buffer.md#buffer_class_slowbuffer 1711[`dns.lookup()`]: dns.md#dns_dns_lookup_hostname_options_callback 1712[`dns.setDefaultResultOrder()`]: dns.md#dns_dns_setdefaultresultorder_order 1713[`dnsPromises.lookup()`]: dns.md#dns_dnspromises_lookup_hostname_options 1714[`process.setUncaughtExceptionCaptureCallback()`]: process.md#process_process_setuncaughtexceptioncapturecallback_fn 1715[`tls.DEFAULT_MAX_VERSION`]: tls.md#tls_tls_default_max_version 1716[`tls.DEFAULT_MIN_VERSION`]: tls.md#tls_tls_default_min_version 1717[`unhandledRejection`]: process.md#process_event_unhandledrejection 1718[`worker_threads.threadId`]: worker_threads.md#worker_threads_worker_threadid 1719[conditional exports]: packages.md#packages_conditional_exports 1720[context-aware]: addons.md#addons_context_aware_addons 1721[customizing ESM specifier resolution]: esm.md#esm_customizing_esm_specifier_resolution_algorithm 1722[debugger]: debugger.md 1723[debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications 1724[emit_warning]: process.md#process_process_emitwarning_warning_type_code_ctor 1725[jitless]: https://v8.dev/blog/jitless 1726[libuv threadpool documentation]: https://docs.libuv.org/en/latest/threadpool.html 1727[remote code execution]: https://www.owasp.org/index.php/Code_Injection 1728