• Home
  • Raw
  • Download

Lines Matching +full:runner +full:- +full:before +full:- +full:script

1 # Command-line API
3 <!--introduced_in=v5.9.1-->
5 <!--type=misc-->
7 Node.js comes with a variety of CLI options. These options expose built-in
14 `node [options] [V8 options] [<program-entry-point> | -e "script" | -] [--] [arguments]`
16 `node inspect [<program-entry-point> | -e "script" | <host>:<port>] …`
18 `node --v8-options`
26 The program entry point is a specifier-like string. If the string is not an
29 [ES module loader][Modules loaders] if [`--experimental-default-type=module`][]
35 * The program was started with a command-line flag that forces the entry
36 point to be loaded with ECMAScript module loader, such as `--import` or
37 [`--experimental-default-type=module`][].
40 `package.json` file contains a top-level [`"type"`][] field with a value of
51 [`--experimental-wasm-modules`][] is enabled; and with no extension when
52 [`--experimental-default-type=module`][] is passed.
56 <!-- YAML
58 - version: v10.12.0
59 pr-url: https://github.com/nodejs/node/pull/23020
62 -->
65 dashes (`-`) or underscores (`_`). For example, `--pending-deprecation` is
66 equivalent to `--pending_deprecation`.
68 If an option that takes a single value (such as `--max-http-header-size`) is
73 ### `-`
75 <!-- YAML
77 -->
79 Alias for stdin. Analogous to the use of `-` in other command-line utilities,
80 meaning that the script is read from stdin, and the rest of the options
81 are passed to that script.
83 ### `--`
85 <!-- YAML
87 -->
89 Indicate the end of node options. Pass the rest of the arguments to the script.
90 If no script filename or eval/print script is supplied prior to this, then
91 the next argument is used as a script filename.
93 ### `--abort-on-uncaught-exception`
95 <!-- YAML
97 -->
99 Aborting instead of exiting causes a core file to be generated for post-mortem
106 ### `--build-snapshot`
108 <!-- YAML
110 -->
112 > Stability: 1 - Experimental
115 disk, which can be loaded later with `--snapshot-blob`.
117 When building the snapshot, if `--snapshot-blob` is not specified,
120 the path specified by `--snapshot-blob`.
127 $ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js
132 $ node --snapshot-blob snapshot.blob index.js
138 script at deserialization time:
142 $ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js
143 $ node --snapshot-blob snapshot.blob
149 Currently the support for run-time snapshot is experimental in that:
151 1. User-land modules are not yet supported in the snapshot, so only
153 into a single script with their bundler of choice before building
155 2. Only a subset of the built-in modules work in the snapshot, though the
160 [tracking issue for user-land snapshots][].
162 ### `--completion-bash`
164 <!-- YAML
166 -->
168 Print source-able bash completion script for Node.js.
171 $ node --completion-bash > node_bash_completion
175 ### `-C condition`, `--conditions=condition`
177 <!-- YAML
179 - v14.9.0
180 - v12.19.0
181 -->
183 > Stability: 1 - Experimental
196 $ node -C development app.js
199 ### `--cpu-prof`
201 <!-- YAML
203 -->
205 > Stability: 1 - Experimental
208 before exit.
210 If `--cpu-prof-dir` is not specified, the generated profile is placed
213 If `--cpu-prof-name` is not specified, the generated profile is
217 $ node --cpu-prof index.js
222 ### `--cpu-prof-dir`
224 <!-- YAML
226 -->
228 > Stability: 1 - Experimental
230 Specify the directory where the CPU profiles generated by `--cpu-prof` will
234 [`--diagnostic-dir`][] command-line option.
236 ### `--cpu-prof-interval`
238 <!-- YAML
240 -->
242 > Stability: 1 - Experimental
245 by `--cpu-prof`. The default is 1000 microseconds.
247 ### `--cpu-prof-name`
249 <!-- YAML
251 -->
253 > Stability: 1 - Experimental
255 Specify the file name of the CPU profile generated by `--cpu-prof`.
257 ### `--diagnostic-dir=directory`
264 * [`--cpu-prof-dir`][]
265 * [`--heap-prof-dir`][]
266 * [`--redirect-warnings`][]
268 ### `--disable-proto=mode`
270 <!-- YAML
272 - v13.12.0
273 - v12.17.0
274 -->
280 ### `--disallow-code-generation-from-strings`
282 <!-- YAML
284 -->
286 Make built-in language features like `eval` and `new Function` that generate
290 ### `--dns-result-order=order`
292 <!-- YAML
294 - v16.4.0
295 - v14.18.0
297 - version: v17.0.0
298 pr-url: https://github.com/nodejs/node/pull/39987
300 -->
309 priority than `--dns-result-order`.
311 ### `--enable-fips`
313 <!-- YAML
315 -->
317 Enable FIPS-compliant crypto at startup. (Requires Node.js to be built
318 against FIPS-compatible OpenSSL.)
320 ### `--enable-network-family-autoselection`
322 <!-- YAML
324 -->
329 ### `--enable-source-maps`
331 <!-- YAML
334 - version:
335 - v15.11.0
336 - v14.18.0
337 pr-url: https://github.com/nodejs/node/pull/37362
339 -->
345 `--enable-source-maps` enables caching of Source Maps and makes a best
348 Overriding `Error.prepareStackTrace` prevents `--enable-source-maps` from
354 of `--enable-source-maps`.
356 ### `--experimental-global-customevent`
358 <!-- YAML
360 -->
364 ### `--experimental-global-webcrypto`
366 <!-- YAML
368 -->
372 ### `--experimental-default-type=type`
374 <!-- YAML
376 - v18.19.0
377 -->
379 > Stability: 1.0 - Early development
383 * String input provided via `--eval` or STDIN, if `--input-type` is unspecified.
392 In other words, `--experimental-default-type=module` flips all the places where
397 Under `--experimental-default-type=module` and `--experimental-wasm-modules`,
402 ### `--experimental-import-meta-resolve`
404 <!-- YAML
406 - v13.9.0
407 - v12.16.2
409 - version: v18.19.0
410 pr-url: https://github.com/nodejs/node/pull/49028
414 -->
421 ### `--experimental-loader=module`
423 <!-- YAML
426 - version: v12.11.1
427 pr-url: https://github.com/nodejs/node/pull/29752
428 description: This flag was renamed from `--loader` to
429 `--experimental-loader`.
430 -->
434 > [`--import` with `register()`][module customization hooks: enabling] instead.
439 ### `--experimental-network-imports`
441 <!-- YAML
443 -->
445 > Stability: 1 - Experimental
449 ### `--experimental-policy`
451 <!-- YAML
453 -->
457 ### `--no-experimental-fetch`
459 <!-- YAML
461 -->
465 ### `--no-experimental-repl-await`
467 <!-- YAML
469 -->
471 Use this flag to disable top-level await in REPL.
473 ### `--experimental-shadow-realm`
475 <!-- YAML
477 -->
481 ### `--experimental-specifier-resolution=mode`
483 <!-- YAML
485 - v13.4.0
486 - v12.16.0
487 -->
498 ### `--experimental-test-coverage`
500 <!-- YAML
503 - version: v18.17.0
504 pr-url: https://github.com/nodejs/node/pull/47686
505 description: This option can be used with `--test`.
506 -->
509 generated as part of the test runner output. If no tests are run, a coverage
513 ### `--experimental-vm-modules`
515 <!-- YAML
517 -->
521 ### `--experimental-wasi-unstable-preview1`
523 <!-- YAML
525 - v13.3.0
526 - v12.16.0
528 - version: v18.17.0
529 pr-url: https://github.com/nodejs/node/pull/47286
532 - version: v13.6.0
533 pr-url: https://github.com/nodejs/node/pull/30980
534 description: changed from `--experimental-wasi-unstable-preview0` to
535 `--experimental-wasi-unstable-preview1`.
536 -->
540 ### `--experimental-wasm-modules`
542 <!-- YAML
544 -->
548 ### `--force-context-aware`
550 <!-- YAML
552 -->
554 Disable loading native addons that are not [context-aware][].
556 ### `--force-fips`
558 <!-- YAML
560 -->
562 Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)
563 (Same requirements as `--enable-fips`.)
565 ### `--frozen-intrinsics`
567 <!-- YAML
569 -->
571 > Stability: 1 - Experimental
580 [`--require`][] and [`--import`][] both run before freezing intrinsics.
582 ### `--force-node-api-uncaught-exceptions-policy`
584 <!-- YAML
586 -->
588 Enforces `uncaughtException` event on Node-API asynchronous callbacks.
590 To prevent from an existing add-on from crashing the process, this flag is not
594 ### `--heapsnapshot-near-heap-limit=max_count`
596 <!-- YAML
598 - v15.1.0
599 - v14.18.0
600 -->
602 > Stability: 1 - Experimental
605 heap limit. `count` should be a non-negative integer (in which case
610 before the Node.js instance finally runs out of memory. These heap snapshots
614 its best to generate at least one and up to `max_count` snapshots before the
626 $ node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js
631 <--- Last few GCs --->
633 [49580:0x110000000] 4826 ms: Mark-sweep 130.6 (147.8) -> 130.5 (147.8) MB, 27.4 / 0.0 ms (aver…
634 [49580:0x110000000] 4845 ms: Mark-sweep 130.6 (147.8) -> 130.6 (147.8) MB, 18.8 / 0.0 ms (aver…
637 <--- JS stacktrace --->
639 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of m…
643 ### `--heapsnapshot-signal=signal`
645 <!-- YAML
647 -->
654 $ node --heapsnapshot-signal=SIGUSR2 index.js &
657 node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2…
658 $ kill -USR2 1
663 ### `--heap-prof`
665 <!-- YAML
667 -->
669 > Stability: 1 - Experimental
672 before exit.
674 If `--heap-prof-dir` is not specified, the generated profile is placed
677 If `--heap-prof-name` is not specified, the generated profile is
681 $ node --heap-prof index.js
686 ### `--heap-prof-dir`
688 <!-- YAML
690 -->
692 > Stability: 1 - Experimental
694 Specify the directory where the heap profiles generated by `--heap-prof` will
698 [`--diagnostic-dir`][] command-line option.
700 ### `--heap-prof-interval`
702 <!-- YAML
704 -->
706 > Stability: 1 - Experimental
709 by `--heap-prof`. The default is 512 \* 1024 bytes.
711 ### `--heap-prof-name`
713 <!-- YAML
715 -->
717 > Stability: 1 - Experimental
719 Specify the file name of the heap profile generated by `--heap-prof`.
721 ### `--icu-data-dir=file`
723 <!-- YAML
725 -->
729 ### `--import=module`
731 <!-- YAML
733 -->
735 > Stability: 1 - Experimental
740 Use [`--require`][] to load a [CommonJS module][].
741 Modules preloaded with `--require` will run before modules preloaded with `--import`.
743 ### `--input-type=type`
745 <!-- YAML
747 -->
750 module. String input is input via `--eval`, `--print`, or `STDIN`.
756 ### `--inspect-brk[=[host:]port]`
758 <!-- YAML
760 -->
762 Activate inspector on `host:port` and break at start of user script.
765 ### `--inspect-port=[host:]port`
767 <!-- YAML
769 -->
779 ### `--inspect[=[host:]port]`
781 <!-- YAML
783 -->
791 <!-- Anchor to make sure old links find a target -->
806 **More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by
807 default) is not firewall-protected.**
811 ### `--inspect-publish-uid=stderr,http`
818 ### `--insecure-http-parser`
820 <!-- YAML
822 - v13.4.0
823 - v12.15.0
824 - v10.19.0
825 -->
828 interoperability with non-conformant HTTP implementations. It may also allow
832 ### `--jitless`
834 <!-- YAML
836 -->
843 disappear in a non-semver-major release.
845 ### `--max-http-header-size=size`
847 <!-- YAML
849 - v11.6.0
850 - v10.15.0
852 - version: v13.13.0
853 pr-url: https://github.com/nodejs/node/pull/32520
855 -->
859 ### `--napi-modules`
861 <!-- YAML
863 -->
865 This option is a no-op. It is kept for compatibility.
867 ### `--no-addons`
869 <!-- YAML
871 - v16.10.0
872 - v14.19.0
873 -->
875 Disable the `node-addons` exports condition as well as disable loading
876 native addons. When `--no-addons` is specified, calling `process.dlopen` or
879 ### `--no-deprecation`
881 <!-- YAML
883 -->
887 ### `--no-extra-info-on-fatal-exception`
889 <!-- YAML
891 -->
895 ### `--no-force-async-hooks-checks`
897 <!-- YAML
899 -->
904 ### `--no-global-search-paths`
906 <!-- YAML
908 -->
913 ### `--no-warnings`
915 <!-- YAML
917 -->
921 ### `--node-memory-debug`
923 <!-- YAML
925 - v15.0.0
926 - v14.18.0
927 -->
932 ### `--openssl-config=file`
934 <!-- YAML
936 -->
939 used to enable FIPS-compliant crypto if Node.js is built
940 against FIPS-enabled OpenSSL.
942 ### `--openssl-shared-config`
944 <!-- YAML
946 -->
951 `OPENSSL_CONF`, or by using the command line option `--openssl-config`.
957 ### `--openssl-legacy-provider`
959 <!-- YAML
961 -->
964 [OSSL\_PROVIDER-legacy][OSSL_PROVIDER-legacy].
966 ### `--pending-deprecation`
968 <!-- YAML
970 -->
976 unless either the `--pending-deprecation` command-line flag, or the
981 ### `--policy-integrity=sri`
983 <!-- YAML
985 -->
987 > Stability: 1 - Experimental
993 ### `--preserve-symlinks`
995 <!-- YAML
997 -->
1003 to a different on-disk location, Node.js will dereference the link and use the
1004 actual on-disk "real path" of the module as both an identifier and as a root
1015 │ ├── moduleA -> {appDir}/moduleA
1024 The `--preserve-symlinks` command-line flag instructs Node.js to use the
1028 Note, however, that using `--preserve-symlinks` can have other side effects.
1034 The `--preserve-symlinks` flag does not apply to the main module, which allows
1035 `node --preserve-symlinks node_module/.bin/<foo>` to work. To apply the same
1036 behavior for the main module, also use `--preserve-symlinks-main`.
1038 ### `--preserve-symlinks-main`
1040 <!-- YAML
1042 -->
1047 This flag exists so that the main module can be opted-in to the same behavior
1048 that `--preserve-symlinks` gives to all other imports; they are separate flags,
1051 `--preserve-symlinks-main` does not imply `--preserve-symlinks`; use
1052 `--preserve-symlinks-main` in addition to
1053 `--preserve-symlinks` when it is not desirable to follow symlinks before
1056 See [`--preserve-symlinks`][] for more information.
1058 ### `--prof`
1060 <!-- YAML
1062 -->
1066 ### `--prof-process`
1068 <!-- YAML
1070 -->
1072 Process V8 profiler output generated using the V8 option `--prof`.
1074 ### `--redirect-warnings=file`
1076 <!-- YAML
1078 -->
1087 [`--diagnostic-dir`][] command-line option.
1089 ### `--report-compact`
1091 <!-- YAML
1093 - v13.12.0
1094 - v12.17.0
1095 -->
1097 Write reports in a compact format, single-line JSON, more easily consumable
1098 by log processing systems than the default multi-line format designed for
1101 ### `--report-dir=directory`, `report-directory=directory`
1103 <!-- YAML
1106 - version:
1107 - v13.12.0
1108 - v12.17.0
1109 pr-url: https://github.com/nodejs/node/pull/32242
1111 - version: v12.0.0
1112 pr-url: https://github.com/nodejs/node/pull/27312
1113 description: Changed from `--diagnostic-report-directory` to
1114 `--report-directory`.
1115 -->
1119 ### `--report-filename=filename`
1121 <!-- YAML
1124 - version:
1125 - v13.12.0
1126 - v12.17.0
1127 pr-url: https://github.com/nodejs/node/pull/32242
1129 - version: v12.0.0
1130 pr-url: https://github.com/nodejs/node/pull/27312
1131 description: changed from `--diagnostic-report-filename` to
1132 `--report-filename`.
1133 -->
1140 ### `--report-on-fatalerror`
1142 <!-- YAML
1145 - version:
1146 - v14.0.0
1147 - v13.14.0
1148 - v12.17.0
1149 pr-url: https://github.com/nodejs/node/pull/32496
1151 - version: v12.0.0
1152 pr-url: https://github.com/nodejs/node/pull/27312
1153 description: changed from `--diagnostic-report-on-fatalerror` to
1154 `--report-on-fatalerror`.
1155 -->
1163 ### `--report-on-signal`
1165 <!-- YAML
1168 - version:
1169 - v13.12.0
1170 - v12.17.0
1171 pr-url: https://github.com/nodejs/node/pull/32242
1173 - version: v12.0.0
1174 pr-url: https://github.com/nodejs/node/pull/27312
1175 description: changed from `--diagnostic-report-on-signal` to
1176 `--report-on-signal`.
1177 -->
1181 specified through `--report-signal`.
1183 ### `--report-signal=signal`
1185 <!-- YAML
1188 - version:
1189 - v13.12.0
1190 - v12.17.0
1191 pr-url: https://github.com/nodejs/node/pull/32242
1193 - version: v12.0.0
1194 pr-url: https://github.com/nodejs/node/pull/27312
1195 description: changed from `--diagnostic-report-signal` to
1196 `--report-signal`.
1197 -->
1202 ### `--report-uncaught-exception`
1204 <!-- YAML
1207 - version: v18.8.0
1208 pr-url: https://github.com/nodejs/node/pull/44208
1210 - version:
1211 - v13.12.0
1212 - v12.17.0
1213 pr-url: https://github.com/nodejs/node/pull/32242
1215 - version: v12.0.0
1216 pr-url: https://github.com/nodejs/node/pull/27312
1217 description: changed from `--diagnostic-report-uncaught-exception` to
1218 `--report-uncaught-exception`.
1219 -->
1225 ### `--secure-heap=n`
1227 <!-- YAML
1229 -->
1250 ### `--secure-heap-min=n`
1252 <!-- YAML
1254 -->
1256 When using `--secure-heap`, the `--secure-heap-min` flag specifies the
1258 The maximum value is the lesser of `--secure-heap` or `2147483647`.
1261 ### `--snapshot-blob=path`
1263 <!-- YAML
1265 -->
1267 > Stability: 1 - Experimental
1269 When used with `--build-snapshot`, `--snapshot-blob` specifies the path
1273 When used without `--build-snapshot`, `--snapshot-blob` specifies the
1286 ### `--test`
1288 <!-- YAML
1291 - version: v18.13.0
1292 pr-url: https://github.com/nodejs/node/pull/45214
1293 description: Test runner now supports running in watch mode.
1294 -->
1296 Starts the Node.js command line test runner. This flag cannot be combined with
1297 `--watch-path`, `--check`, `--eval`, `--interactive`, or the inspector.
1301 ### `--test-concurrency`
1303 <!-- YAML
1305 -->
1307 The maximum number of test files that the test runner CLI will execute
1308 concurrently. The default value is `os.availableParallelism() - 1`.
1310 ### `--test-name-pattern`
1312 <!-- YAML
1314 -->
1316 A regular expression that configures the test runner to only execute tests
1320 ### `--test-reporter`
1322 <!-- YAML
1324 -->
1329 ### `--test-reporter-destination`
1331 <!-- YAML
1333 -->
1338 ### `--test-only`
1340 <!-- YAML
1342 -->
1344 Configures the test runner to only execute top level tests that have the `only`
1347 ### `--test-shard`
1349 <!-- YAML
1351 -->
1363 node --test --test-shard=1/3
1364 node --test --test-shard=2/3
1365 node --test --test-shard=3/3
1368 ### `--throw-deprecation`
1370 <!-- YAML
1372 -->
1376 ### `--title=title`
1378 <!-- YAML
1380 -->
1384 ### `--tls-cipher-list=list`
1386 <!-- YAML
1388 -->
1393 ### `--tls-keylog=file`
1395 <!-- YAML
1397 - v13.2.0
1398 - v12.16.0
1399 -->
1405 ### `--tls-max-v1.2`
1407 <!-- YAML
1409 - v12.0.0
1410 - v10.20.0
1411 -->
1416 ### `--tls-max-v1.3`
1418 <!-- YAML
1420 -->
1425 ### `--tls-min-v1.0`
1427 <!-- YAML
1429 - v12.0.0
1430 - v10.20.0
1431 -->
1436 ### `--tls-min-v1.1`
1438 <!-- YAML
1440 - v12.0.0
1441 - v10.20.0
1442 -->
1447 ### `--tls-min-v1.2`
1449 <!-- YAML
1451 - v12.2.0
1452 - v10.20.0
1453 -->
1459 ### `--tls-min-v1.3`
1461 <!-- YAML
1463 -->
1468 ### `--trace-atomics-wait`
1470 <!-- YAML
1473 -->
1475 > Stability: 0 - Deprecated
1486 (node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) started
1488 (node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) was woken up by another thread
1499 ### `--trace-deprecation`
1501 <!-- YAML
1503 -->
1507 ### `--trace-event-categories`
1509 <!-- YAML
1511 -->
1514 tracing is enabled using `--trace-events-enabled`.
1516 ### `--trace-event-file-pattern`
1518 <!-- YAML
1520 -->
1525 ### `--trace-events-enabled`
1527 <!-- YAML
1529 -->
1533 ### `--trace-exit`
1535 <!-- YAML
1537 - v13.5.0
1538 - v12.16.0
1539 -->
1544 ### `--trace-sigint`
1546 <!-- YAML
1548 - v13.9.0
1549 - v12.17.0
1550 -->
1554 ### `--trace-sync-io`
1556 <!-- YAML
1558 -->
1563 ### `--trace-tls`
1565 <!-- YAML
1567 -->
1572 ### `--trace-uncaught`
1574 <!-- YAML
1576 -->
1585 ### `--trace-warnings`
1587 <!-- YAML
1589 -->
1593 ### `--track-heap-objects`
1595 <!-- YAML
1597 -->
1601 ### `--unhandled-rejections=mode`
1603 <!-- YAML
1605 - v12.0.0
1606 - v10.17.0
1608 - version: v15.0.0
1609 pr-url: https://github.com/nodejs/node/pull/33021
1612 -->
1623 * `warn-with-error-code`: Emit [`unhandledRejection`][]. If this hook is not
1630 ### `--use-bundled-ca`, `--use-openssl-ca`
1632 <!-- YAML
1634 -->
1638 at build-time.
1651 ### `--use-largepages=mode`
1653 <!-- YAML
1655 - v13.6.0
1656 - v12.17.0
1657 -->
1659 Re-map the Node.js static code to large memory pages at startup. If supported on
1671 ### `--v8-options`
1673 <!-- YAML
1675 -->
1677 Print V8 command-line options.
1679 ### `--v8-pool-size=num`
1681 <!-- YAML
1683 -->
1694 ### `--watch`
1696 <!-- YAML
1699 - version: v18.13.0
1700 pr-url: https://github.com/nodejs/node/pull/45214
1701 description: Test runner now supports running in watch mode.
1702 -->
1704 > Stability: 1 - Experimental
1711 Use `--watch-path` to specify what paths to watch.
1714 `--check`, `--eval`, `--interactive`, or the REPL.
1717 $ node --watch index.js
1720 ### `--watch-path`
1722 <!-- YAML
1724 -->
1726 > Stability: 1 - Experimental
1732 combination with `--watch`.
1735 `--check`, `--eval`, `--interactive`, `--test`, or the REPL.
1738 $ node --watch-path=./src --watch-path=./tests index.js
1745 ### `--watch-preserve-output`
1750 $ node --watch --watch-preserve-output test.js
1753 ### `--zero-fill-buffers`
1755 <!-- YAML
1757 -->
1759 Automatically zero-fills all newly allocated [`Buffer`][] and [`SlowBuffer`][]
1762 ### `-c`, `--check`
1764 <!-- YAML
1766 - v5.0.0
1767 - v4.2.0
1769 - version: v10.0.0
1770 pr-url: https://github.com/nodejs/node/pull/19600
1771 description: The `--require` option is now supported when checking a file.
1772 -->
1774 Syntax check the script without executing.
1776 ### `-e`, `--eval "script"`
1778 <!-- YAML
1781 - version: v5.11.0
1782 pr-url: https://github.com/nodejs/node/pull/5348
1783 description: Built-in libraries are now available as predefined variables.
1784 -->
1787 predefined in the REPL can also be used in `script`.
1793 ### `-h`, `--help`
1795 <!-- YAML
1797 -->
1799 Print node command-line options.
1802 ### `-i`, `--interactive`
1804 <!-- YAML
1806 -->
1810 ### `-p`, `--print "script"`
1812 <!-- YAML
1815 - version: v5.11.0
1816 pr-url: https://github.com/nodejs/node/pull/5348
1817 description: Built-in libraries are now available as predefined variables.
1818 -->
1820 Identical to `-e` but prints the result.
1822 ### `-r`, `--require module`
1824 <!-- YAML
1826 -->
1834 Use [`--import`][] to preload an [ECMAScript module][].
1835 Modules preloaded with `--require` will run before modules preloaded with `--import`.
1837 ### `-v`, `--version`
1839 <!-- YAML
1841 -->
1852 * `1`, `true`, or the empty string `''` indicate 16-color support,
1853 * `2` to indicate 256-color support, or
1854 * `3` to indicate 16 million-color support.
1863 <!-- YAML
1865 -->
1867 `','`-separated list of core modules that should print debug information.
1871 `','`-separated list of core C++ modules that should print debug information.
1875 <!-- YAML
1877 -->
1883 <!-- YAML
1885 -->
1905 <!-- YAML
1907 -->
1909 Data path for ICU (`Intl` object) data. Will extend linked-in data when compiled
1910 with small-icu support.
1914 <!-- YAML
1916 -->
1922 <!-- YAML
1924 -->
1926 A space-separated list of command-line options. `options...` are interpreted
1927 before command-line options, so command-line options will override or
1929 an option that is not allowed in the environment is used, such as `-p` or a
1930 script file.
1935 NODE_OPTIONS='--require "./my path/file.js"'
1938 A singleton flag passed as a command-line option will override the same flag
1943 NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555
1947 `NODE_OPTIONS` instances were passed first, and then its command-line
1951 NODE_OPTIONS='--require "./a.js"' node --require "./b.js"
1953 node --require "./a.js" --require "./b.js"
1958 <!-- node-options-node start -->
1960 * `--conditions`, `-C`
1961 * `--diagnostic-dir`
1962 * `--disable-proto`
1963 * `--dns-result-order`
1964 * `--enable-fips`
1965 * `--enable-network-family-autoselection`
1966 * `--enable-source-maps`
1967 * `--experimental-abortcontroller`
1968 * `--experimental-default-type`
1969 * `--experimental-global-customevent`
1970 * `--experimental-global-webcrypto`
1971 * `--experimental-import-meta-resolve`
1972 * `--experimental-json-modules`
1973 * `--experimental-loader`
1974 * `--experimental-modules`
1975 * `--experimental-network-imports`
1976 * `--experimental-policy`
1977 * `--experimental-shadow-realm`
1978 * `--experimental-specifier-resolution`
1979 * `--experimental-top-level-await`
1980 * `--experimental-vm-modules`
1981 * `--experimental-wasi-unstable-preview1`
1982 * `--experimental-wasm-modules`
1983 * `--force-context-aware`
1984 * `--force-fips`
1985 * `--force-node-api-uncaught-exceptions-policy`
1986 * `--frozen-intrinsics`
1987 * `--heapsnapshot-near-heap-limit`
1988 * `--heapsnapshot-signal`
1989 * `--http-parser`
1990 * `--icu-data-dir`
1991 * `--import`
1992 * `--input-type`
1993 * `--insecure-http-parser`
1994 * `--inspect-brk`
1995 * `--inspect-port`, `--debug-port`
1996 * `--inspect-publish-uid`
1997 * `--inspect`
1998 * `--max-http-header-size`
1999 * `--napi-modules`
2000 * `--no-addons`
2001 * `--no-deprecation`
2002 * `--no-experimental-fetch`
2003 * `--no-experimental-repl-await`
2004 * `--no-extra-info-on-fatal-exception`
2005 * `--no-force-async-hooks-checks`
2006 * `--no-global-search-paths`
2007 * `--no-warnings`
2008 * `--node-memory-debug`
2009 * `--openssl-config`
2010 * `--openssl-legacy-provider`
2011 * `--openssl-shared-config`
2012 * `--pending-deprecation`
2013 * `--policy-integrity`
2014 * `--preserve-symlinks-main`
2015 * `--preserve-symlinks`
2016 * `--prof-process`
2017 * `--redirect-warnings`
2018 * `--report-compact`
2019 * `--report-dir`, `--report-directory`
2020 * `--report-filename`
2021 * `--report-on-fatalerror`
2022 * `--report-on-signal`
2023 * `--report-signal`
2024 * `--report-uncaught-exception`
2025 * `--require`, `-r`
2026 * `--secure-heap-min`
2027 * `--secure-heap`
2028 * `--snapshot-blob`
2029 * `--test-only`
2030 * `--test-reporter-destination`
2031 * `--test-reporter`
2032 * `--test-shard`
2033 * `--throw-deprecation`
2034 * `--title`
2035 * `--tls-cipher-list`
2036 * `--tls-keylog`
2037 * `--tls-max-v1.2`
2038 * `--tls-max-v1.3`
2039 * `--tls-min-v1.0`
2040 * `--tls-min-v1.1`
2041 * `--tls-min-v1.2`
2042 * `--tls-min-v1.3`
2043 * `--trace-atomics-wait`
2044 * `--trace-deprecation`
2045 * `--trace-event-categories`
2046 * `--trace-event-file-pattern`
2047 * `--trace-events-enabled`
2048 * `--trace-exit`
2049 * `--trace-sigint`
2050 * `--trace-sync-io`
2051 * `--trace-tls`
2052 * `--trace-uncaught`
2053 * `--trace-warnings`
2054 * `--track-heap-objects`
2055 * `--unhandled-rejections`
2056 * `--use-bundled-ca`
2057 * `--use-largepages`
2058 * `--use-openssl-ca`
2059 * `--v8-pool-size`
2060 * `--watch-path`
2061 * `--watch-preserve-output`
2062 * `--watch`
2063 * `--zero-fill-buffers`
2065 <!-- node-options-node end -->
2069 <!-- node-options-v8 start -->
2071 * `--abort-on-uncaught-exception`
2072 * `--disallow-code-generation-from-strings`
2073 * `--enable-etw-stack-walking`
2074 * `--huge-max-old-generation-size`
2075 * `--interpreted-frames-native-stack`
2076 * `--jitless`
2077 * `--max-old-space-size`
2078 * `--max-semi-space-size`
2079 * `--perf-basic-prof-only-functions`
2080 * `--perf-basic-prof`
2081 * `--perf-prof-unwinding-info`
2082 * `--perf-prof`
2083 * `--stack-trace-limit`
2085 <!-- node-options-v8 end -->
2087 `--perf-basic-prof-only-functions`, `--perf-basic-prof`,
2088 `--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux.
2090 `--enable-etw-stack-walking` is only available on Windows.
2094 <!-- YAML
2096 -->
2098 `':'`-separated list of directories prefixed to the module search path.
2100 On Windows, this is a `';'`-separated list instead.
2104 <!-- YAML
2106 -->
2112 unless either the `--pending-deprecation` command-line flag, or the
2124 <!-- YAML
2126 -->
2133 <!-- YAML
2135 -->
2141 equivalent to using the `--redirect-warnings=file` command-line flag.
2145 <!-- YAML
2147 -->
2155 <!-- YAML
2157 - v13.0.0
2158 - v12.16.0
2159 -->
2161 Path to a Node.js module which will be loaded in place of the built-in REPL.
2162 Overriding this value to an empty string (`''`) will use the built-in REPL.
2166 <!-- YAML
2168 -->
2199 Coverage is output as an array of [ScriptCoverage][] objects on the top-level
2216 > Stability: 1 - Experimental
2218 If found, source map data is appended to the top-level key `source-map-cache`
2221 `source-map-cache` is an object with keys representing the files source maps
2222 were extracted from, and values which include the raw source-map URL
2235 "source-map-cache": {
2237 "url": "./path-to-map.json",
2269 <!-- YAML
2271 -->
2274 used to enable FIPS-compliant crypto if Node.js is built with
2275 `./configure --openssl-fips`.
2277 If the [`--openssl-config`][] command-line option is used, the environment
2282 <!-- YAML
2284 -->
2286 If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's directory
2295 <!-- YAML
2297 -->
2299 If `--use-openssl-ca` is enabled, this overrides and sets OpenSSL's file
2308 <!-- YAML
2311 - version:
2312 - v16.2.0
2313 pr-url: https://github.com/nodejs/node/pull/38642
2317 - version:
2318 - v13.0.0
2319 pr-url: https://github.com/nodejs/node/pull/20026
2323 -->
2334 $ TZ=Europe/Dublin node -pe "new Date().toString()"
2372 ### `--max-old-space-size=SIZE` (in megabytes)
2382 $ node --max-old-space-size=1536 index.js
2385 ### `--max-semi-space-size=SIZE` (in megabytes)
2387 Sets the maximum [semi-space][] size for V8's [scavenge garbage collector][] in
2389 Increasing the max size of a semi-space may improve throughput for Node.js at
2393 [`YoungGenerationSizeFromSemiSpaceSize`][] in V8) the size of the semi-space,
2394 an increase of 1 MiB to semi-space applies to each of the three individual
2395 semi-spaces and causes the heap size to increase by 3 MiB. The throughput
2398 The default value is 16 MiB for 64-bit systems and 8 MiB for 32-bit systems. To
2400 max-semi-space-size values when running benchmarks for your application.
2402 For example, benchmark on a 64-bit systems:
2406 node --max-semi-space-size=$MiB index.js
2411 [Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
2415 [ECMAScript module]: esm.md#modules-ecmascript-modules
2416 [Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
2417 [Module customization hooks]: module.md#customization-hooks
2419 [Modules loaders]: packages.md#modules-loaders
2421 [OSSL_PROVIDER-legacy]: https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html
2423 [ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCovera…
2424 [ShadowRealm]: https://github.com/tc39/proposal-shadowrealm
2426 [Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
2427 [V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
2430 [`--cpu-prof-dir`]: #--cpu-prof-dir
2431 [`--diagnostic-dir`]: #--diagnostic-dirdirectory
2432 [`--experimental-default-type=module`]: #--experimental-default-typetype
2433 [`--experimental-wasm-modules`]: #--experimental-wasm-modules
2434 [`--heap-prof-dir`]: #--heap-prof-dir
2435 [`--import`]: #--importmodule
2436 [`--openssl-config`]: #--openssl-configfile
2437 [`--preserve-symlinks`]: #--preserve-symlinks
2438 [`--redirect-warnings`]: #--redirect-warningsfile
2439 [`--require`]: #-r---require-module
2440 [`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Object…
2441 [`Buffer`]: buffer.md#class-buffer
2444 [`NO_COLOR`]: https://no-color.org
2445 [`SlowBuffer`]: buffer.md#class-slowbuffer
2447 [`dns.lookup()`]: dns.md#dnslookuphostname-options-callback
2449 [`dnsPromises.lookup()`]: dns.md#dnspromiseslookuphostname-options
2450 [`import` specifier]: esm.md#import-specifiers
2454 [`unhandledRejection`]: process.md#event-unhandledrejection
2455 [`v8.startupSnapshot` API]: v8.md#startup-snapshot-api
2457 [collecting code coverage from tests]: test.md#collecting-code-coverage
2458 [conditional exports]: packages.md#conditional-exports
2459 [context-aware]: addons.md#context-aware-addons
2460 [customizing ESM specifier resolution]: esm.md#customizing-esm-specifier-resolution-algorithm
2462 …rity implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implicat…
2463 [emit_warning]: process.md#processemitwarningwarning-options
2464 [filtering tests by name]: test.md#filtering-tests-by-name
2468 [running tests from the command line]: test.md#running-tests-from-the-command-line
2469 [scavenge garbage collector]: https://v8.dev/blog/orinoco-parallel-scavenger
2470 [security warning]: #warning-binding-inspector-to-a-public-ipport-combination-is-insecure
2471 [semi-space]: https://www.memorymanagement.org/glossary/s.html#semi.space
2472 [test reporters]: test.md#test-reporters
2474 [tracking issue for user-land snapshots]: https://github.com/nodejs/node/issues/44014
2475 …handled in other environments]: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html