1<!DOCTYPE html> 2<html lang="en"> 3<head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width"> 6 <meta name="nodejs.org:node-version" content="v18.20.1"> 7 <title>Command-line API | Node.js v18.20.1 Documentation</title> 8 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback"> 9 <link rel="stylesheet" href="assets/style.css"> 10 <link rel="stylesheet" href="assets/hljs.css"> 11 <link rel="canonical" href="https://nodejs.org/api/cli.html"> 12 <script async defer src="assets/api.js" type="text/javascript"></script> 13 14</head> 15<body class="alt apidoc" id="api-section-cli"> 16 <div id="content" class="clearfix"> 17 <div id="column2" class="interior"> 18 <div id="intro" class="interior"> 19 <a href="/" title="Go back to the home page"> 20 Node.js 21 </a> 22 </div> 23 <ul> 24<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li> 25<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li> 26</ul> 27<hr class="line"> 28<ul> 29<li><a href="assert.html" class="nav-assert">Assertion testing</a></li> 30<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li> 31<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li> 32<li><a href="buffer.html" class="nav-buffer">Buffer</a></li> 33<li><a href="addons.html" class="nav-addons">C++ addons</a></li> 34<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li> 35<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li> 36<li><a href="child_process.html" class="nav-child_process">Child processes</a></li> 37<li><a href="cluster.html" class="nav-cluster">Cluster</a></li> 38<li><a href="cli.html" class="nav-cli active">Command-line options</a></li> 39<li><a href="console.html" class="nav-console">Console</a></li> 40<li><a href="corepack.html" class="nav-corepack">Corepack</a></li> 41<li><a href="crypto.html" class="nav-crypto">Crypto</a></li> 42<li><a href="debugger.html" class="nav-debugger">Debugger</a></li> 43<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li> 44<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li> 45<li><a href="dns.html" class="nav-dns">DNS</a></li> 46<li><a href="domain.html" class="nav-domain">Domain</a></li> 47<li><a href="errors.html" class="nav-errors">Errors</a></li> 48<li><a href="events.html" class="nav-events">Events</a></li> 49<li><a href="fs.html" class="nav-fs">File system</a></li> 50<li><a href="globals.html" class="nav-globals">Globals</a></li> 51<li><a href="http.html" class="nav-http">HTTP</a></li> 52<li><a href="http2.html" class="nav-http2">HTTP/2</a></li> 53<li><a href="https.html" class="nav-https">HTTPS</a></li> 54<li><a href="inspector.html" class="nav-inspector">Inspector</a></li> 55<li><a href="intl.html" class="nav-intl">Internationalization</a></li> 56<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li> 57<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li> 58<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li> 59<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li> 60<li><a href="net.html" class="nav-net">Net</a></li> 61<li><a href="os.html" class="nav-os">OS</a></li> 62<li><a href="path.html" class="nav-path">Path</a></li> 63<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li> 64<li><a href="permissions.html" class="nav-permissions">Permissions</a></li> 65<li><a href="process.html" class="nav-process">Process</a></li> 66<li><a href="punycode.html" class="nav-punycode">Punycode</a></li> 67<li><a href="querystring.html" class="nav-querystring">Query strings</a></li> 68<li><a href="readline.html" class="nav-readline">Readline</a></li> 69<li><a href="repl.html" class="nav-repl">REPL</a></li> 70<li><a href="report.html" class="nav-report">Report</a></li> 71<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li> 72<li><a href="stream.html" class="nav-stream">Stream</a></li> 73<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li> 74<li><a href="test.html" class="nav-test">Test runner</a></li> 75<li><a href="timers.html" class="nav-timers">Timers</a></li> 76<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li> 77<li><a href="tracing.html" class="nav-tracing">Trace events</a></li> 78<li><a href="tty.html" class="nav-tty">TTY</a></li> 79<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li> 80<li><a href="url.html" class="nav-url">URL</a></li> 81<li><a href="util.html" class="nav-util">Utilities</a></li> 82<li><a href="v8.html" class="nav-v8">V8</a></li> 83<li><a href="vm.html" class="nav-vm">VM</a></li> 84<li><a href="wasi.html" class="nav-wasi">WASI</a></li> 85<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li> 86<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li> 87<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li> 88<li><a href="zlib.html" class="nav-zlib">Zlib</a></li> 89</ul> 90<hr class="line"> 91<ul> 92<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li> 93</ul> 94 </div> 95 96 <div id="column1" data-id="cli" class="interior"> 97 <header class="header"> 98 <div class="header-container"> 99 <h1>Node.js v18.20.1 documentation</h1> 100 <button class="theme-toggle-btn" id="theme-toggle-btn" title="Toggle dark mode/light mode" aria-label="Toggle dark mode/light mode" hidden> 101 <svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24"> 102 <path fill="none" d="M0 0h24v24H0z" /> 103 <path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/> 104 <path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/> 105 </svg> 106 <svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24"> 107 <path d="M0 0h24v24H0z" fill="none" /> 108 <path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/> 109 </svg> 110 </button> 111 </div> 112 <div id="gtoc"> 113 <ul> 114 <li class="pinned-header">Node.js v18.20.1</li> 115 116 <li class="picker-header"> 117 <a href="#"> 118 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span> 119 Table of contents 120 </a> 121 122 <div class="picker"><div class="toc"><ul> 123<li><a href="#command-line-api">Command-line API</a> 124<ul> 125<li><a href="#synopsis">Synopsis</a></li> 126<li><a href="#program-entry-point">Program entry point</a> 127<ul> 128<li><a href="#ecmascript-modules-loader-entry-point-caveat">ECMAScript modules loader entry point caveat</a></li> 129</ul> 130</li> 131<li><a href="#options">Options</a> 132<ul> 133<li><a href="#-"><code>-</code></a></li> 134<li><a href="#--"><code>--</code></a></li> 135<li><a href="#--abort-on-uncaught-exception"><code>--abort-on-uncaught-exception</code></a></li> 136<li><span class="stability_1"><a href="#--build-snapshot"><code>--build-snapshot</code></a></span></li> 137<li><a href="#--completion-bash"><code>--completion-bash</code></a></li> 138<li><span class="stability_1"><a href="#-c-condition---conditionscondition"><code>-C condition</code>, <code>--conditions=condition</code></a></span></li> 139<li><span class="stability_1"><a href="#--cpu-prof"><code>--cpu-prof</code></a></span></li> 140<li><span class="stability_1"><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></span></li> 141<li><span class="stability_1"><a href="#--cpu-prof-interval"><code>--cpu-prof-interval</code></a></span></li> 142<li><span class="stability_1"><a href="#--cpu-prof-name"><code>--cpu-prof-name</code></a></span></li> 143<li><a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir=directory</code></a></li> 144<li><a href="#--disable-protomode"><code>--disable-proto=mode</code></a></li> 145<li><a href="#--disallow-code-generation-from-strings"><code>--disallow-code-generation-from-strings</code></a></li> 146<li><a href="#--dns-result-orderorder"><code>--dns-result-order=order</code></a></li> 147<li><a href="#--enable-fips"><code>--enable-fips</code></a></li> 148<li><a href="#--enable-network-family-autoselection"><code>--enable-network-family-autoselection</code></a></li> 149<li><a href="#--enable-source-maps"><code>--enable-source-maps</code></a></li> 150<li><a href="#--experimental-global-customevent"><code>--experimental-global-customevent</code></a></li> 151<li><a href="#--experimental-global-webcrypto"><code>--experimental-global-webcrypto</code></a></li> 152<li><span class="stability_1"><a href="#--experimental-default-typetype"><code>--experimental-default-type=type</code></a></span></li> 153<li><a href="#--experimental-import-meta-resolve"><code>--experimental-import-meta-resolve</code></a></li> 154<li><a href="#--experimental-loadermodule"><code>--experimental-loader=module</code></a></li> 155<li><span class="stability_1"><a href="#--experimental-network-imports"><code>--experimental-network-imports</code></a></span></li> 156<li><a href="#--experimental-policy"><code>--experimental-policy</code></a></li> 157<li><a href="#--no-experimental-fetch"><code>--no-experimental-fetch</code></a></li> 158<li><a href="#--no-experimental-repl-await"><code>--no-experimental-repl-await</code></a></li> 159<li><a href="#--experimental-shadow-realm"><code>--experimental-shadow-realm</code></a></li> 160<li><a href="#--experimental-specifier-resolutionmode"><code>--experimental-specifier-resolution=mode</code></a></li> 161<li><a href="#--experimental-test-coverage"><code>--experimental-test-coverage</code></a></li> 162<li><a href="#--experimental-vm-modules"><code>--experimental-vm-modules</code></a></li> 163<li><a href="#--experimental-wasi-unstable-preview1"><code>--experimental-wasi-unstable-preview1</code></a></li> 164<li><a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a></li> 165<li><a href="#--force-context-aware"><code>--force-context-aware</code></a></li> 166<li><a href="#--force-fips"><code>--force-fips</code></a></li> 167<li><span class="stability_1"><a href="#--frozen-intrinsics"><code>--frozen-intrinsics</code></a></span></li> 168<li><a href="#--force-node-api-uncaught-exceptions-policy"><code>--force-node-api-uncaught-exceptions-policy</code></a></li> 169<li><span class="stability_1"><a href="#--heapsnapshot-near-heap-limitmax_count"><code>--heapsnapshot-near-heap-limit=max_count</code></a></span></li> 170<li><a href="#--heapsnapshot-signalsignal"><code>--heapsnapshot-signal=signal</code></a></li> 171<li><span class="stability_1"><a href="#--heap-prof"><code>--heap-prof</code></a></span></li> 172<li><span class="stability_1"><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></span></li> 173<li><span class="stability_1"><a href="#--heap-prof-interval"><code>--heap-prof-interval</code></a></span></li> 174<li><span class="stability_1"><a href="#--heap-prof-name"><code>--heap-prof-name</code></a></span></li> 175<li><a href="#--icu-data-dirfile"><code>--icu-data-dir=file</code></a></li> 176<li><span class="stability_1"><a href="#--importmodule"><code>--import=module</code></a></span></li> 177<li><a href="#--input-typetype"><code>--input-type=type</code></a></li> 178<li><a href="#--inspect-brkhostport"><code>--inspect-brk[=[host:]port]</code></a></li> 179<li><a href="#--inspect-porthostport"><code>--inspect-port=[host:]port</code></a></li> 180<li><a href="#--inspecthostport"><code>--inspect[=[host:]port]</code></a> 181<ul> 182<li><a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">Warning: binding inspector to a public IP:port combination is insecure</a></li> 183</ul> 184</li> 185<li><a href="#--inspect-publish-uidstderrhttp"><code>--inspect-publish-uid=stderr,http</code></a></li> 186<li><a href="#--insecure-http-parser"><code>--insecure-http-parser</code></a></li> 187<li><a href="#--jitless"><code>--jitless</code></a></li> 188<li><a href="#--max-http-header-sizesize"><code>--max-http-header-size=size</code></a></li> 189<li><a href="#--napi-modules"><code>--napi-modules</code></a></li> 190<li><a href="#--no-addons"><code>--no-addons</code></a></li> 191<li><a href="#--no-deprecation"><code>--no-deprecation</code></a></li> 192<li><a href="#--no-extra-info-on-fatal-exception"><code>--no-extra-info-on-fatal-exception</code></a></li> 193<li><a href="#--no-force-async-hooks-checks"><code>--no-force-async-hooks-checks</code></a></li> 194<li><a href="#--no-global-search-paths"><code>--no-global-search-paths</code></a></li> 195<li><a href="#--no-warnings"><code>--no-warnings</code></a></li> 196<li><a href="#--node-memory-debug"><code>--node-memory-debug</code></a></li> 197<li><a href="#--openssl-configfile"><code>--openssl-config=file</code></a></li> 198<li><a href="#--openssl-shared-config"><code>--openssl-shared-config</code></a></li> 199<li><a href="#--openssl-legacy-provider"><code>--openssl-legacy-provider</code></a></li> 200<li><a href="#--pending-deprecation"><code>--pending-deprecation</code></a></li> 201<li><span class="stability_1"><a href="#--policy-integritysri"><code>--policy-integrity=sri</code></a></span></li> 202<li><a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a></li> 203<li><a href="#--preserve-symlinks-main"><code>--preserve-symlinks-main</code></a></li> 204<li><a href="#--prof"><code>--prof</code></a></li> 205<li><a href="#--prof-process"><code>--prof-process</code></a></li> 206<li><a href="#--redirect-warningsfile"><code>--redirect-warnings=file</code></a></li> 207<li><a href="#--report-compact"><code>--report-compact</code></a></li> 208<li><a href="#--report-dirdirectory-report-directorydirectory"><code>--report-dir=directory</code>, <code>report-directory=directory</code></a></li> 209<li><a href="#--report-filenamefilename"><code>--report-filename=filename</code></a></li> 210<li><a href="#--report-on-fatalerror"><code>--report-on-fatalerror</code></a></li> 211<li><a href="#--report-on-signal"><code>--report-on-signal</code></a></li> 212<li><a href="#--report-signalsignal"><code>--report-signal=signal</code></a></li> 213<li><a href="#--report-uncaught-exception"><code>--report-uncaught-exception</code></a></li> 214<li><a href="#--secure-heapn"><code>--secure-heap=n</code></a></li> 215<li><a href="#--secure-heap-minn"><code>--secure-heap-min=n</code></a></li> 216<li><span class="stability_1"><a href="#--snapshot-blobpath"><code>--snapshot-blob=path</code></a></span></li> 217<li><a href="#--test"><code>--test</code></a></li> 218<li><a href="#--test-concurrency"><code>--test-concurrency</code></a></li> 219<li><a href="#--test-name-pattern"><code>--test-name-pattern</code></a></li> 220<li><a href="#--test-reporter"><code>--test-reporter</code></a></li> 221<li><a href="#--test-reporter-destination"><code>--test-reporter-destination</code></a></li> 222<li><a href="#--test-only"><code>--test-only</code></a></li> 223<li><a href="#--test-shard"><code>--test-shard</code></a></li> 224<li><a href="#--throw-deprecation"><code>--throw-deprecation</code></a></li> 225<li><a href="#--titletitle"><code>--title=title</code></a></li> 226<li><a href="#--tls-cipher-listlist"><code>--tls-cipher-list=list</code></a></li> 227<li><a href="#--tls-keylogfile"><code>--tls-keylog=file</code></a></li> 228<li><a href="#--tls-max-v12"><code>--tls-max-v1.2</code></a></li> 229<li><a href="#--tls-max-v13"><code>--tls-max-v1.3</code></a></li> 230<li><a href="#--tls-min-v10"><code>--tls-min-v1.0</code></a></li> 231<li><a href="#--tls-min-v11"><code>--tls-min-v1.1</code></a></li> 232<li><a href="#--tls-min-v12"><code>--tls-min-v1.2</code></a></li> 233<li><a href="#--tls-min-v13"><code>--tls-min-v1.3</code></a></li> 234<li><span class="stability_0"><a href="#--trace-atomics-wait"><code>--trace-atomics-wait</code></a></span></li> 235<li><a href="#--trace-deprecation"><code>--trace-deprecation</code></a></li> 236<li><a href="#--trace-event-categories"><code>--trace-event-categories</code></a></li> 237<li><a href="#--trace-event-file-pattern"><code>--trace-event-file-pattern</code></a></li> 238<li><a href="#--trace-events-enabled"><code>--trace-events-enabled</code></a></li> 239<li><a href="#--trace-exit"><code>--trace-exit</code></a></li> 240<li><a href="#--trace-sigint"><code>--trace-sigint</code></a></li> 241<li><a href="#--trace-sync-io"><code>--trace-sync-io</code></a></li> 242<li><a href="#--trace-tls"><code>--trace-tls</code></a></li> 243<li><a href="#--trace-uncaught"><code>--trace-uncaught</code></a></li> 244<li><a href="#--trace-warnings"><code>--trace-warnings</code></a></li> 245<li><a href="#--track-heap-objects"><code>--track-heap-objects</code></a></li> 246<li><a href="#--unhandled-rejectionsmode"><code>--unhandled-rejections=mode</code></a></li> 247<li><a href="#--use-bundled-ca---use-openssl-ca"><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code></a></li> 248<li><a href="#--use-largepagesmode"><code>--use-largepages=mode</code></a></li> 249<li><a href="#--v8-options"><code>--v8-options</code></a></li> 250<li><a href="#--v8-pool-sizenum"><code>--v8-pool-size=num</code></a></li> 251<li><span class="stability_1"><a href="#--watch"><code>--watch</code></a></span></li> 252<li><span class="stability_1"><a href="#--watch-path"><code>--watch-path</code></a></span></li> 253<li><a href="#--watch-preserve-output"><code>--watch-preserve-output</code></a></li> 254<li><a href="#--zero-fill-buffers"><code>--zero-fill-buffers</code></a></li> 255<li><a href="#-c---check"><code>-c</code>, <code>--check</code></a></li> 256<li><a href="#-e---eval-script"><code>-e</code>, <code>--eval "script"</code></a></li> 257<li><a href="#-h---help"><code>-h</code>, <code>--help</code></a></li> 258<li><a href="#-i---interactive"><code>-i</code>, <code>--interactive</code></a></li> 259<li><a href="#-p---print-script"><code>-p</code>, <code>--print "script"</code></a></li> 260<li><a href="#-r---require-module"><code>-r</code>, <code>--require module</code></a></li> 261<li><a href="#-v---version"><code>-v</code>, <code>--version</code></a></li> 262</ul> 263</li> 264<li><a href="#environment-variables">Environment variables</a> 265<ul> 266<li><a href="#force_color1-2-3"><code>FORCE_COLOR=[1, 2, 3]</code></a></li> 267<li><a href="#node_debugmodule"><code>NODE_DEBUG=module[,…]</code></a></li> 268<li><a href="#node_debug_nativemodule"><code>NODE_DEBUG_NATIVE=module[,…]</code></a></li> 269<li><a href="#node_disable_colors1"><code>NODE_DISABLE_COLORS=1</code></a></li> 270<li><a href="#node_extra_ca_certsfile"><code>NODE_EXTRA_CA_CERTS=file</code></a></li> 271<li><a href="#node_icu_datafile"><code>NODE_ICU_DATA=file</code></a></li> 272<li><a href="#node_no_warnings1"><code>NODE_NO_WARNINGS=1</code></a></li> 273<li><a href="#node_optionsoptions"><code>NODE_OPTIONS=options...</code></a></li> 274<li><a href="#node_pathpath"><code>NODE_PATH=path[:…]</code></a></li> 275<li><a href="#node_pending_deprecation1"><code>NODE_PENDING_DEPRECATION=1</code></a></li> 276<li><a href="#node_pending_pipe_instancesinstances"><code>NODE_PENDING_PIPE_INSTANCES=instances</code></a></li> 277<li><a href="#node_preserve_symlinks1"><code>NODE_PRESERVE_SYMLINKS=1</code></a></li> 278<li><a href="#node_redirect_warningsfile"><code>NODE_REDIRECT_WARNINGS=file</code></a></li> 279<li><a href="#node_repl_historyfile"><code>NODE_REPL_HISTORY=file</code></a></li> 280<li><a href="#node_repl_external_modulefile"><code>NODE_REPL_EXTERNAL_MODULE=file</code></a></li> 281<li><a href="#node_skip_platform_checkvalue"><code>NODE_SKIP_PLATFORM_CHECK=value</code></a></li> 282<li><a href="#node_test_contextvalue"><code>NODE_TEST_CONTEXT=value</code></a></li> 283<li><a href="#node_tls_reject_unauthorizedvalue"><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code></a></li> 284<li><a href="#node_v8_coveragedir"><code>NODE_V8_COVERAGE=dir</code></a> 285<ul> 286<li><a href="#coverage-output">Coverage output</a></li> 287<li><span class="stability_1"><a href="#source-map-cache">Source map cache</a></span></li> 288</ul> 289</li> 290<li><a href="#no_colorany"><code>NO_COLOR=<any></code></a></li> 291<li><a href="#openssl_conffile"><code>OPENSSL_CONF=file</code></a></li> 292<li><a href="#ssl_cert_dirdir"><code>SSL_CERT_DIR=dir</code></a></li> 293<li><a href="#ssl_cert_filefile"><code>SSL_CERT_FILE=file</code></a></li> 294<li><a href="#tz"><code>TZ</code></a></li> 295<li><a href="#uv_threadpool_sizesize"><code>UV_THREADPOOL_SIZE=size</code></a></li> 296</ul> 297</li> 298<li><a href="#useful-v8-options">Useful V8 options</a> 299<ul> 300<li><a href="#--max-old-space-sizesize-in-megabytes"><code>--max-old-space-size=SIZE</code> (in megabytes)</a></li> 301<li><a href="#--max-semi-space-sizesize-in-megabytes"><code>--max-semi-space-size=SIZE</code> (in megabytes)</a></li> 302</ul> 303</li> 304</ul> 305</li> 306</ul></div></div> 307 </li> 308 309 310 <li class="picker-header"> 311 <a href="#"> 312 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span> 313 Index 314 </a> 315 316 <div class="picker"><ul> 317<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li> 318<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li> 319 320 <li> 321 <a href="index.html">Index</a> 322 </li> 323 </ul> 324 325<hr class="line"> 326<ul> 327<li><a href="assert.html" class="nav-assert">Assertion testing</a></li> 328<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li> 329<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li> 330<li><a href="buffer.html" class="nav-buffer">Buffer</a></li> 331<li><a href="addons.html" class="nav-addons">C++ addons</a></li> 332<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li> 333<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li> 334<li><a href="child_process.html" class="nav-child_process">Child processes</a></li> 335<li><a href="cluster.html" class="nav-cluster">Cluster</a></li> 336<li><a href="cli.html" class="nav-cli active">Command-line options</a></li> 337<li><a href="console.html" class="nav-console">Console</a></li> 338<li><a href="corepack.html" class="nav-corepack">Corepack</a></li> 339<li><a href="crypto.html" class="nav-crypto">Crypto</a></li> 340<li><a href="debugger.html" class="nav-debugger">Debugger</a></li> 341<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li> 342<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li> 343<li><a href="dns.html" class="nav-dns">DNS</a></li> 344<li><a href="domain.html" class="nav-domain">Domain</a></li> 345<li><a href="errors.html" class="nav-errors">Errors</a></li> 346<li><a href="events.html" class="nav-events">Events</a></li> 347<li><a href="fs.html" class="nav-fs">File system</a></li> 348<li><a href="globals.html" class="nav-globals">Globals</a></li> 349<li><a href="http.html" class="nav-http">HTTP</a></li> 350<li><a href="http2.html" class="nav-http2">HTTP/2</a></li> 351<li><a href="https.html" class="nav-https">HTTPS</a></li> 352<li><a href="inspector.html" class="nav-inspector">Inspector</a></li> 353<li><a href="intl.html" class="nav-intl">Internationalization</a></li> 354<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li> 355<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li> 356<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li> 357<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li> 358<li><a href="net.html" class="nav-net">Net</a></li> 359<li><a href="os.html" class="nav-os">OS</a></li> 360<li><a href="path.html" class="nav-path">Path</a></li> 361<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li> 362<li><a href="permissions.html" class="nav-permissions">Permissions</a></li> 363<li><a href="process.html" class="nav-process">Process</a></li> 364<li><a href="punycode.html" class="nav-punycode">Punycode</a></li> 365<li><a href="querystring.html" class="nav-querystring">Query strings</a></li> 366<li><a href="readline.html" class="nav-readline">Readline</a></li> 367<li><a href="repl.html" class="nav-repl">REPL</a></li> 368<li><a href="report.html" class="nav-report">Report</a></li> 369<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li> 370<li><a href="stream.html" class="nav-stream">Stream</a></li> 371<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li> 372<li><a href="test.html" class="nav-test">Test runner</a></li> 373<li><a href="timers.html" class="nav-timers">Timers</a></li> 374<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li> 375<li><a href="tracing.html" class="nav-tracing">Trace events</a></li> 376<li><a href="tty.html" class="nav-tty">TTY</a></li> 377<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li> 378<li><a href="url.html" class="nav-url">URL</a></li> 379<li><a href="util.html" class="nav-util">Utilities</a></li> 380<li><a href="v8.html" class="nav-v8">V8</a></li> 381<li><a href="vm.html" class="nav-vm">VM</a></li> 382<li><a href="wasi.html" class="nav-wasi">WASI</a></li> 383<li><a href="webcrypto.html" class="nav-webcrypto">Web Crypto API</a></li> 384<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li> 385<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li> 386<li><a href="zlib.html" class="nav-zlib">Zlib</a></li> 387</ul> 388<hr class="line"> 389<ul> 390<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li> 391</ul></div> 392 </li> 393 394 395 <li class="picker-header"> 396 <a href="#"> 397 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span> 398 Other versions 399 </a> 400 <div class="picker"><ol id="alt-docs"><li><a href="https://nodejs.org/docs/latest-v21.x/api/cli.html">21.x</a></li> 401<li><a href="https://nodejs.org/docs/latest-v20.x/api/cli.html">20.x <b>LTS</b></a></li> 402<li><a href="https://nodejs.org/docs/latest-v19.x/api/cli.html">19.x</a></li> 403<li><a href="https://nodejs.org/docs/latest-v18.x/api/cli.html">18.x <b>LTS</b></a></li> 404<li><a href="https://nodejs.org/docs/latest-v17.x/api/cli.html">17.x</a></li> 405<li><a href="https://nodejs.org/docs/latest-v16.x/api/cli.html">16.x</a></li> 406<li><a href="https://nodejs.org/docs/latest-v15.x/api/cli.html">15.x</a></li> 407<li><a href="https://nodejs.org/docs/latest-v14.x/api/cli.html">14.x</a></li> 408<li><a href="https://nodejs.org/docs/latest-v13.x/api/cli.html">13.x</a></li> 409<li><a href="https://nodejs.org/docs/latest-v12.x/api/cli.html">12.x</a></li> 410<li><a href="https://nodejs.org/docs/latest-v11.x/api/cli.html">11.x</a></li> 411<li><a href="https://nodejs.org/docs/latest-v10.x/api/cli.html">10.x</a></li> 412<li><a href="https://nodejs.org/docs/latest-v9.x/api/cli.html">9.x</a></li> 413<li><a href="https://nodejs.org/docs/latest-v8.x/api/cli.html">8.x</a></li> 414<li><a href="https://nodejs.org/docs/latest-v7.x/api/cli.html">7.x</a></li> 415<li><a href="https://nodejs.org/docs/latest-v6.x/api/cli.html">6.x</a></li> 416<li><a href="https://nodejs.org/docs/latest-v5.x/api/cli.html">5.x</a></li></ol></div> 417 </li> 418 419 <li class="picker-header"> 420 <a href="#"> 421 <span class="collapsed-arrow">►</span><span class="expanded-arrow">▼</span> 422 Options 423 </a> 424 425 <div class="picker"> 426 <ul> 427 <li> 428 <a href="all.html">View on single page</a> 429 </li> 430 <li> 431 <a href="cli.json">View as JSON</a> 432 </li> 433 <li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/cli.md">Edit on GitHub</a></li> 434 </ul> 435 </div> 436 </li> 437 </ul> 438 </div> 439 <hr> 440 </header> 441 442 <details id="toc" open><summary>Table of contents</summary><ul> 443<li><a href="#command-line-api">Command-line API</a> 444<ul> 445<li><a href="#synopsis">Synopsis</a></li> 446<li><a href="#program-entry-point">Program entry point</a> 447<ul> 448<li><a href="#ecmascript-modules-loader-entry-point-caveat">ECMAScript modules loader entry point caveat</a></li> 449</ul> 450</li> 451<li><a href="#options">Options</a> 452<ul> 453<li><a href="#-"><code>-</code></a></li> 454<li><a href="#--"><code>--</code></a></li> 455<li><a href="#--abort-on-uncaught-exception"><code>--abort-on-uncaught-exception</code></a></li> 456<li><span class="stability_1"><a href="#--build-snapshot"><code>--build-snapshot</code></a></span></li> 457<li><a href="#--completion-bash"><code>--completion-bash</code></a></li> 458<li><span class="stability_1"><a href="#-c-condition---conditionscondition"><code>-C condition</code>, <code>--conditions=condition</code></a></span></li> 459<li><span class="stability_1"><a href="#--cpu-prof"><code>--cpu-prof</code></a></span></li> 460<li><span class="stability_1"><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></span></li> 461<li><span class="stability_1"><a href="#--cpu-prof-interval"><code>--cpu-prof-interval</code></a></span></li> 462<li><span class="stability_1"><a href="#--cpu-prof-name"><code>--cpu-prof-name</code></a></span></li> 463<li><a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir=directory</code></a></li> 464<li><a href="#--disable-protomode"><code>--disable-proto=mode</code></a></li> 465<li><a href="#--disallow-code-generation-from-strings"><code>--disallow-code-generation-from-strings</code></a></li> 466<li><a href="#--dns-result-orderorder"><code>--dns-result-order=order</code></a></li> 467<li><a href="#--enable-fips"><code>--enable-fips</code></a></li> 468<li><a href="#--enable-network-family-autoselection"><code>--enable-network-family-autoselection</code></a></li> 469<li><a href="#--enable-source-maps"><code>--enable-source-maps</code></a></li> 470<li><a href="#--experimental-global-customevent"><code>--experimental-global-customevent</code></a></li> 471<li><a href="#--experimental-global-webcrypto"><code>--experimental-global-webcrypto</code></a></li> 472<li><span class="stability_1"><a href="#--experimental-default-typetype"><code>--experimental-default-type=type</code></a></span></li> 473<li><a href="#--experimental-import-meta-resolve"><code>--experimental-import-meta-resolve</code></a></li> 474<li><a href="#--experimental-loadermodule"><code>--experimental-loader=module</code></a></li> 475<li><span class="stability_1"><a href="#--experimental-network-imports"><code>--experimental-network-imports</code></a></span></li> 476<li><a href="#--experimental-policy"><code>--experimental-policy</code></a></li> 477<li><a href="#--no-experimental-fetch"><code>--no-experimental-fetch</code></a></li> 478<li><a href="#--no-experimental-repl-await"><code>--no-experimental-repl-await</code></a></li> 479<li><a href="#--experimental-shadow-realm"><code>--experimental-shadow-realm</code></a></li> 480<li><a href="#--experimental-specifier-resolutionmode"><code>--experimental-specifier-resolution=mode</code></a></li> 481<li><a href="#--experimental-test-coverage"><code>--experimental-test-coverage</code></a></li> 482<li><a href="#--experimental-vm-modules"><code>--experimental-vm-modules</code></a></li> 483<li><a href="#--experimental-wasi-unstable-preview1"><code>--experimental-wasi-unstable-preview1</code></a></li> 484<li><a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a></li> 485<li><a href="#--force-context-aware"><code>--force-context-aware</code></a></li> 486<li><a href="#--force-fips"><code>--force-fips</code></a></li> 487<li><span class="stability_1"><a href="#--frozen-intrinsics"><code>--frozen-intrinsics</code></a></span></li> 488<li><a href="#--force-node-api-uncaught-exceptions-policy"><code>--force-node-api-uncaught-exceptions-policy</code></a></li> 489<li><span class="stability_1"><a href="#--heapsnapshot-near-heap-limitmax_count"><code>--heapsnapshot-near-heap-limit=max_count</code></a></span></li> 490<li><a href="#--heapsnapshot-signalsignal"><code>--heapsnapshot-signal=signal</code></a></li> 491<li><span class="stability_1"><a href="#--heap-prof"><code>--heap-prof</code></a></span></li> 492<li><span class="stability_1"><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></span></li> 493<li><span class="stability_1"><a href="#--heap-prof-interval"><code>--heap-prof-interval</code></a></span></li> 494<li><span class="stability_1"><a href="#--heap-prof-name"><code>--heap-prof-name</code></a></span></li> 495<li><a href="#--icu-data-dirfile"><code>--icu-data-dir=file</code></a></li> 496<li><span class="stability_1"><a href="#--importmodule"><code>--import=module</code></a></span></li> 497<li><a href="#--input-typetype"><code>--input-type=type</code></a></li> 498<li><a href="#--inspect-brkhostport"><code>--inspect-brk[=[host:]port]</code></a></li> 499<li><a href="#--inspect-porthostport"><code>--inspect-port=[host:]port</code></a></li> 500<li><a href="#--inspecthostport"><code>--inspect[=[host:]port]</code></a> 501<ul> 502<li><a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">Warning: binding inspector to a public IP:port combination is insecure</a></li> 503</ul> 504</li> 505<li><a href="#--inspect-publish-uidstderrhttp"><code>--inspect-publish-uid=stderr,http</code></a></li> 506<li><a href="#--insecure-http-parser"><code>--insecure-http-parser</code></a></li> 507<li><a href="#--jitless"><code>--jitless</code></a></li> 508<li><a href="#--max-http-header-sizesize"><code>--max-http-header-size=size</code></a></li> 509<li><a href="#--napi-modules"><code>--napi-modules</code></a></li> 510<li><a href="#--no-addons"><code>--no-addons</code></a></li> 511<li><a href="#--no-deprecation"><code>--no-deprecation</code></a></li> 512<li><a href="#--no-extra-info-on-fatal-exception"><code>--no-extra-info-on-fatal-exception</code></a></li> 513<li><a href="#--no-force-async-hooks-checks"><code>--no-force-async-hooks-checks</code></a></li> 514<li><a href="#--no-global-search-paths"><code>--no-global-search-paths</code></a></li> 515<li><a href="#--no-warnings"><code>--no-warnings</code></a></li> 516<li><a href="#--node-memory-debug"><code>--node-memory-debug</code></a></li> 517<li><a href="#--openssl-configfile"><code>--openssl-config=file</code></a></li> 518<li><a href="#--openssl-shared-config"><code>--openssl-shared-config</code></a></li> 519<li><a href="#--openssl-legacy-provider"><code>--openssl-legacy-provider</code></a></li> 520<li><a href="#--pending-deprecation"><code>--pending-deprecation</code></a></li> 521<li><span class="stability_1"><a href="#--policy-integritysri"><code>--policy-integrity=sri</code></a></span></li> 522<li><a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a></li> 523<li><a href="#--preserve-symlinks-main"><code>--preserve-symlinks-main</code></a></li> 524<li><a href="#--prof"><code>--prof</code></a></li> 525<li><a href="#--prof-process"><code>--prof-process</code></a></li> 526<li><a href="#--redirect-warningsfile"><code>--redirect-warnings=file</code></a></li> 527<li><a href="#--report-compact"><code>--report-compact</code></a></li> 528<li><a href="#--report-dirdirectory-report-directorydirectory"><code>--report-dir=directory</code>, <code>report-directory=directory</code></a></li> 529<li><a href="#--report-filenamefilename"><code>--report-filename=filename</code></a></li> 530<li><a href="#--report-on-fatalerror"><code>--report-on-fatalerror</code></a></li> 531<li><a href="#--report-on-signal"><code>--report-on-signal</code></a></li> 532<li><a href="#--report-signalsignal"><code>--report-signal=signal</code></a></li> 533<li><a href="#--report-uncaught-exception"><code>--report-uncaught-exception</code></a></li> 534<li><a href="#--secure-heapn"><code>--secure-heap=n</code></a></li> 535<li><a href="#--secure-heap-minn"><code>--secure-heap-min=n</code></a></li> 536<li><span class="stability_1"><a href="#--snapshot-blobpath"><code>--snapshot-blob=path</code></a></span></li> 537<li><a href="#--test"><code>--test</code></a></li> 538<li><a href="#--test-concurrency"><code>--test-concurrency</code></a></li> 539<li><a href="#--test-name-pattern"><code>--test-name-pattern</code></a></li> 540<li><a href="#--test-reporter"><code>--test-reporter</code></a></li> 541<li><a href="#--test-reporter-destination"><code>--test-reporter-destination</code></a></li> 542<li><a href="#--test-only"><code>--test-only</code></a></li> 543<li><a href="#--test-shard"><code>--test-shard</code></a></li> 544<li><a href="#--throw-deprecation"><code>--throw-deprecation</code></a></li> 545<li><a href="#--titletitle"><code>--title=title</code></a></li> 546<li><a href="#--tls-cipher-listlist"><code>--tls-cipher-list=list</code></a></li> 547<li><a href="#--tls-keylogfile"><code>--tls-keylog=file</code></a></li> 548<li><a href="#--tls-max-v12"><code>--tls-max-v1.2</code></a></li> 549<li><a href="#--tls-max-v13"><code>--tls-max-v1.3</code></a></li> 550<li><a href="#--tls-min-v10"><code>--tls-min-v1.0</code></a></li> 551<li><a href="#--tls-min-v11"><code>--tls-min-v1.1</code></a></li> 552<li><a href="#--tls-min-v12"><code>--tls-min-v1.2</code></a></li> 553<li><a href="#--tls-min-v13"><code>--tls-min-v1.3</code></a></li> 554<li><span class="stability_0"><a href="#--trace-atomics-wait"><code>--trace-atomics-wait</code></a></span></li> 555<li><a href="#--trace-deprecation"><code>--trace-deprecation</code></a></li> 556<li><a href="#--trace-event-categories"><code>--trace-event-categories</code></a></li> 557<li><a href="#--trace-event-file-pattern"><code>--trace-event-file-pattern</code></a></li> 558<li><a href="#--trace-events-enabled"><code>--trace-events-enabled</code></a></li> 559<li><a href="#--trace-exit"><code>--trace-exit</code></a></li> 560<li><a href="#--trace-sigint"><code>--trace-sigint</code></a></li> 561<li><a href="#--trace-sync-io"><code>--trace-sync-io</code></a></li> 562<li><a href="#--trace-tls"><code>--trace-tls</code></a></li> 563<li><a href="#--trace-uncaught"><code>--trace-uncaught</code></a></li> 564<li><a href="#--trace-warnings"><code>--trace-warnings</code></a></li> 565<li><a href="#--track-heap-objects"><code>--track-heap-objects</code></a></li> 566<li><a href="#--unhandled-rejectionsmode"><code>--unhandled-rejections=mode</code></a></li> 567<li><a href="#--use-bundled-ca---use-openssl-ca"><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code></a></li> 568<li><a href="#--use-largepagesmode"><code>--use-largepages=mode</code></a></li> 569<li><a href="#--v8-options"><code>--v8-options</code></a></li> 570<li><a href="#--v8-pool-sizenum"><code>--v8-pool-size=num</code></a></li> 571<li><span class="stability_1"><a href="#--watch"><code>--watch</code></a></span></li> 572<li><span class="stability_1"><a href="#--watch-path"><code>--watch-path</code></a></span></li> 573<li><a href="#--watch-preserve-output"><code>--watch-preserve-output</code></a></li> 574<li><a href="#--zero-fill-buffers"><code>--zero-fill-buffers</code></a></li> 575<li><a href="#-c---check"><code>-c</code>, <code>--check</code></a></li> 576<li><a href="#-e---eval-script"><code>-e</code>, <code>--eval "script"</code></a></li> 577<li><a href="#-h---help"><code>-h</code>, <code>--help</code></a></li> 578<li><a href="#-i---interactive"><code>-i</code>, <code>--interactive</code></a></li> 579<li><a href="#-p---print-script"><code>-p</code>, <code>--print "script"</code></a></li> 580<li><a href="#-r---require-module"><code>-r</code>, <code>--require module</code></a></li> 581<li><a href="#-v---version"><code>-v</code>, <code>--version</code></a></li> 582</ul> 583</li> 584<li><a href="#environment-variables">Environment variables</a> 585<ul> 586<li><a href="#force_color1-2-3"><code>FORCE_COLOR=[1, 2, 3]</code></a></li> 587<li><a href="#node_debugmodule"><code>NODE_DEBUG=module[,…]</code></a></li> 588<li><a href="#node_debug_nativemodule"><code>NODE_DEBUG_NATIVE=module[,…]</code></a></li> 589<li><a href="#node_disable_colors1"><code>NODE_DISABLE_COLORS=1</code></a></li> 590<li><a href="#node_extra_ca_certsfile"><code>NODE_EXTRA_CA_CERTS=file</code></a></li> 591<li><a href="#node_icu_datafile"><code>NODE_ICU_DATA=file</code></a></li> 592<li><a href="#node_no_warnings1"><code>NODE_NO_WARNINGS=1</code></a></li> 593<li><a href="#node_optionsoptions"><code>NODE_OPTIONS=options...</code></a></li> 594<li><a href="#node_pathpath"><code>NODE_PATH=path[:…]</code></a></li> 595<li><a href="#node_pending_deprecation1"><code>NODE_PENDING_DEPRECATION=1</code></a></li> 596<li><a href="#node_pending_pipe_instancesinstances"><code>NODE_PENDING_PIPE_INSTANCES=instances</code></a></li> 597<li><a href="#node_preserve_symlinks1"><code>NODE_PRESERVE_SYMLINKS=1</code></a></li> 598<li><a href="#node_redirect_warningsfile"><code>NODE_REDIRECT_WARNINGS=file</code></a></li> 599<li><a href="#node_repl_historyfile"><code>NODE_REPL_HISTORY=file</code></a></li> 600<li><a href="#node_repl_external_modulefile"><code>NODE_REPL_EXTERNAL_MODULE=file</code></a></li> 601<li><a href="#node_skip_platform_checkvalue"><code>NODE_SKIP_PLATFORM_CHECK=value</code></a></li> 602<li><a href="#node_test_contextvalue"><code>NODE_TEST_CONTEXT=value</code></a></li> 603<li><a href="#node_tls_reject_unauthorizedvalue"><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code></a></li> 604<li><a href="#node_v8_coveragedir"><code>NODE_V8_COVERAGE=dir</code></a> 605<ul> 606<li><a href="#coverage-output">Coverage output</a></li> 607<li><span class="stability_1"><a href="#source-map-cache">Source map cache</a></span></li> 608</ul> 609</li> 610<li><a href="#no_colorany"><code>NO_COLOR=<any></code></a></li> 611<li><a href="#openssl_conffile"><code>OPENSSL_CONF=file</code></a></li> 612<li><a href="#ssl_cert_dirdir"><code>SSL_CERT_DIR=dir</code></a></li> 613<li><a href="#ssl_cert_filefile"><code>SSL_CERT_FILE=file</code></a></li> 614<li><a href="#tz"><code>TZ</code></a></li> 615<li><a href="#uv_threadpool_sizesize"><code>UV_THREADPOOL_SIZE=size</code></a></li> 616</ul> 617</li> 618<li><a href="#useful-v8-options">Useful V8 options</a> 619<ul> 620<li><a href="#--max-old-space-sizesize-in-megabytes"><code>--max-old-space-size=SIZE</code> (in megabytes)</a></li> 621<li><a href="#--max-semi-space-sizesize-in-megabytes"><code>--max-semi-space-size=SIZE</code> (in megabytes)</a></li> 622</ul> 623</li> 624</ul> 625</li> 626</ul></details> 627 628 <div id="apicontent"> 629 <h2>Command-line API<span><a class="mark" href="#command-line-api" id="command-line-api">#</a></span><a aria-hidden="true" class="legacy" id="cli_command_line_api"></a></h2> 630 631 632<p>Node.js comes with a variety of CLI options. These options expose built-in 633debugging, multiple ways to execute scripts, and other helpful runtime options.</p> 634<p>To view this documentation as a manual page in a terminal, run <code>man node</code>.</p> 635<section><h3>Synopsis<span><a class="mark" href="#synopsis" id="synopsis">#</a></span><a aria-hidden="true" class="legacy" id="cli_synopsis"></a></h3> 636<p><code>node [options] [V8 options] [<program-entry-point> | -e "script" | -] [--] [arguments]</code></p> 637<p><code>node inspect [<program-entry-point> | -e "script" | <host>:<port>] …</code></p> 638<p><code>node --v8-options</code></p> 639<p>Execute without arguments to start the <a href="repl.html">REPL</a>.</p> 640<p>For more info about <code>node inspect</code>, see the <a href="debugger.html">debugger</a> documentation.</p> 641</section><section><h3>Program entry point<span><a class="mark" href="#program-entry-point" id="program-entry-point">#</a></span><a aria-hidden="true" class="legacy" id="cli_program_entry_point"></a></h3> 642<p>The program entry point is a specifier-like string. If the string is not an 643absolute path, it's resolved as a relative path from the current working 644directory. That path is then resolved by <a href="modules.html">CommonJS</a> module loader, or by the 645<a href="packages.html#modules-loaders">ES module loader</a> if <a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a> 646is passed. If no corresponding file is found, an error is thrown.</p> 647<p>If a file is found, its path will be passed to the 648<a href="packages.html#modules-loaders">ES module loader</a> under any of the following conditions:</p> 649<ul> 650<li>The program was started with a command-line flag that forces the entry 651point to be loaded with ECMAScript module loader, such as <code>--import</code> or 652<a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a>.</li> 653<li>The file has an <code>.mjs</code> extension.</li> 654<li>The file does not have a <code>.cjs</code> extension, and the nearest parent 655<code>package.json</code> file contains a top-level <a href="packages.html#type"><code>"type"</code></a> field with a value of 656<code>"module"</code>.</li> 657</ul> 658<p>Otherwise, the file is loaded using the CommonJS module loader. See 659<a href="packages.html#modules-loaders">Modules loaders</a> for more details.</p> 660<h4>ECMAScript modules loader entry point caveat<span><a class="mark" href="#ecmascript-modules-loader-entry-point-caveat" id="ecmascript-modules-loader-entry-point-caveat">#</a></span><a aria-hidden="true" class="legacy" id="cli_ecmascript_modules_loader_entry_point_caveat"></a></h4> 661<p>When loading, the <a href="packages.html#modules-loaders">ES module loader</a> loads the program 662entry point, the <code>node</code> command will accept as input only files with <code>.js</code>, 663<code>.mjs</code>, or <code>.cjs</code> extensions; with <code>.wasm</code> extensions when 664<a href="#--experimental-wasm-modules"><code>--experimental-wasm-modules</code></a> is enabled; and with no extension when 665<a href="#--experimental-default-typetype"><code>--experimental-default-type=module</code></a> is passed.</p> 666</section><section><h3>Options<span><a class="mark" href="#options" id="options">#</a></span><a aria-hidden="true" class="legacy" id="cli_options"></a></h3> 667<div class="api_metadata"> 668<details class="changelog"><summary>History</summary> 669<table> 670<tbody><tr><th>Version</th><th>Changes</th></tr> 671<tr><td>v10.12.0</td> 672<td><p>Underscores instead of dashes are now allowed for Node.js options as well, in addition to V8 options.</p></td></tr> 673</tbody></table> 674</details> 675</div> 676<p>All options, including V8 options, allow words to be separated by both 677dashes (<code>-</code>) or underscores (<code>_</code>). For example, <code>--pending-deprecation</code> is 678equivalent to <code>--pending_deprecation</code>.</p> 679<p>If an option that takes a single value (such as <code>--max-http-header-size</code>) is 680passed more than once, then the last passed value is used. Options from the 681command line take precedence over options passed through the <a href="#node_optionsoptions"><code>NODE_OPTIONS</code></a> 682environment variable.</p> 683<h4><code>-</code><span><a class="mark" href="#-" id="-">#</a></span><a aria-hidden="true" class="legacy" id="cli"></a></h4> 684<div class="api_metadata"> 685<span>Added in: v8.0.0</span> 686</div> 687<p>Alias for stdin. Analogous to the use of <code>-</code> in other command-line utilities, 688meaning that the script is read from stdin, and the rest of the options 689are passed to that script.</p> 690<h4><code>--</code><span><a class="mark" href="#--" id="--">#</a></span><a aria-hidden="true" class="legacy" id="cli_1"></a></h4> 691<div class="api_metadata"> 692<span>Added in: v6.11.0</span> 693</div> 694<p>Indicate the end of node options. Pass the rest of the arguments to the script. 695If no script filename or eval/print script is supplied prior to this, then 696the next argument is used as a script filename.</p> 697<h4><code>--abort-on-uncaught-exception</code><span><a class="mark" href="#--abort-on-uncaught-exception" id="--abort-on-uncaught-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_abort_on_uncaught_exception"></a></h4> 698<div class="api_metadata"> 699<span>Added in: v0.10.8</span> 700</div> 701<p>Aborting instead of exiting causes a core file to be generated for post-mortem 702analysis using a debugger (such as <code>lldb</code>, <code>gdb</code>, and <code>mdb</code>).</p> 703<p>If this flag is passed, the behavior can still be set to not abort through 704<a href="process.html#processsetuncaughtexceptioncapturecallbackfn"><code>process.setUncaughtExceptionCaptureCallback()</code></a> (and through usage of the 705<code>node:domain</code> module that uses it).</p> 706<h4><code>--build-snapshot</code><span><a class="mark" href="#--build-snapshot" id="--build-snapshot">#</a></span><a aria-hidden="true" class="legacy" id="cli_build_snapshot"></a></h4> 707<div class="api_metadata"> 708<span>Added in: v18.8.0</span> 709</div> 710<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 711<p>Generates a snapshot blob when the process exits and writes it to 712disk, which can be loaded later with <code>--snapshot-blob</code>.</p> 713<p>When building the snapshot, if <code>--snapshot-blob</code> is not specified, 714the generated blob will be written, by default, to <code>snapshot.blob</code> 715in the current working directory. Otherwise it will be written to 716the path specified by <code>--snapshot-blob</code>.</p> 717<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"globalThis.foo = 'I am from the snapshot'"</span> > snapshot.js</span> 718<span class="hljs-meta prompt_"> 719# </span><span class="language-bash">Run snapshot.js to initialize the application and snapshot the</span> 720<span class="hljs-meta prompt_"># </span><span class="language-bash">state of it into snapshot.blob.</span> 721<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob --build-snapshot snapshot.js</span> 722<span class="hljs-meta prompt_"> 723$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"console.log(globalThis.foo)"</span> > index.js</span> 724<span class="hljs-meta prompt_"> 725# </span><span class="language-bash">Load the generated snapshot and start the application from index.js.</span> 726<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob index.js</span> 727I am from the snapshot</code> <button class="copy-button">copy</button></pre> 728<p>The <a href="v8.html#startup-snapshot-api"><code>v8.startupSnapshot</code> API</a> can be used to specify an entry point at 729snapshot building time, thus avoiding the need of an additional entry 730script at deserialization time:</p> 731<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">"require('v8').startupSnapshot.setDeserializeMainFunction(() => console.log('I am from the snapshot'))"</span> > snapshot.js</span> 732<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob --build-snapshot snapshot.js</span> 733<span class="hljs-meta prompt_">$ </span><span class="language-bash">node --snapshot-blob snapshot.blob</span> 734I am from the snapshot</code> <button class="copy-button">copy</button></pre> 735<p>For more information, check out the <a href="v8.html#startup-snapshot-api"><code>v8.startupSnapshot</code> API</a> documentation.</p> 736<p>Currently the support for run-time snapshot is experimental in that:</p> 737<ol> 738<li>User-land modules are not yet supported in the snapshot, so only 739one single file can be snapshotted. Users can bundle their applications 740into a single script with their bundler of choice before building 741a snapshot, however.</li> 742<li>Only a subset of the built-in modules work in the snapshot, though the 743Node.js core test suite checks that a few fairly complex applications 744can be snapshotted. Support for more modules are being added. If any 745crashes or buggy behaviors occur when building a snapshot, please file 746a report in the <a href="https://github.com/nodejs/node/issues">Node.js issue tracker</a> and link to it in the 747<a href="https://github.com/nodejs/node/issues/44014">tracking issue for user-land snapshots</a>.</li> 748</ol> 749<h4><code>--completion-bash</code><span><a class="mark" href="#--completion-bash" id="--completion-bash">#</a></span><a aria-hidden="true" class="legacy" id="cli_completion_bash"></a></h4> 750<div class="api_metadata"> 751<span>Added in: v10.12.0</span> 752</div> 753<p>Print source-able bash completion script for Node.js.</p> 754<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --completion-bash > node_bash_completion</span> 755<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">source</span> node_bash_completion</span></code> <button class="copy-button">copy</button></pre> 756<h4><code>-C condition</code>, <code>--conditions=condition</code><span><a class="mark" href="#-c-condition---conditionscondition" id="-c-condition---conditionscondition">#</a></span><a aria-hidden="true" class="legacy" id="cli_c_condition_conditions_condition"></a></h4> 757<div class="api_metadata"> 758<span>Added in: v14.9.0, v12.19.0</span> 759</div> 760<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 761<p>Enable experimental support for custom <a href="packages.html#conditional-exports">conditional exports</a> resolution 762conditions.</p> 763<p>Any number of custom string condition names are permitted.</p> 764<p>The default Node.js conditions of <code>"node"</code>, <code>"default"</code>, <code>"import"</code>, and 765<code>"require"</code> will always apply as defined.</p> 766<p>For example, to run a module with "development" resolutions:</p> 767<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node -C development app.js</span></code> <button class="copy-button">copy</button></pre> 768<h4><code>--cpu-prof</code><span><a class="mark" href="#--cpu-prof" id="--cpu-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof"></a></h4> 769<div class="api_metadata"> 770<span>Added in: v12.0.0</span> 771</div> 772<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 773<p>Starts the V8 CPU profiler on start up, and writes the CPU profile to disk 774before exit.</p> 775<p>If <code>--cpu-prof-dir</code> is not specified, the generated profile is placed 776in the current working directory.</p> 777<p>If <code>--cpu-prof-name</code> is not specified, the generated profile is 778named <code>CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile</code>.</p> 779<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --cpu-prof index.js</span> 780<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> *.cpuprofile</span> 781CPU.20190409.202950.15293.0.0.cpuprofile</code> <button class="copy-button">copy</button></pre> 782<h4><code>--cpu-prof-dir</code><span><a class="mark" href="#--cpu-prof-dir" id="--cpu-prof-dir">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_dir"></a></h4> 783<div class="api_metadata"> 784<span>Added in: v12.0.0</span> 785</div> 786<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 787<p>Specify the directory where the CPU profiles generated by <code>--cpu-prof</code> will 788be placed.</p> 789<p>The default value is controlled by the 790<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p> 791<h4><code>--cpu-prof-interval</code><span><a class="mark" href="#--cpu-prof-interval" id="--cpu-prof-interval">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_interval"></a></h4> 792<div class="api_metadata"> 793<span>Added in: v12.2.0</span> 794</div> 795<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 796<p>Specify the sampling interval in microseconds for the CPU profiles generated 797by <code>--cpu-prof</code>. The default is 1000 microseconds.</p> 798<h4><code>--cpu-prof-name</code><span><a class="mark" href="#--cpu-prof-name" id="--cpu-prof-name">#</a></span><a aria-hidden="true" class="legacy" id="cli_cpu_prof_name"></a></h4> 799<div class="api_metadata"> 800<span>Added in: v12.0.0</span> 801</div> 802<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 803<p>Specify the file name of the CPU profile generated by <code>--cpu-prof</code>.</p> 804<h4><code>--diagnostic-dir=directory</code><span><a class="mark" href="#--diagnostic-dirdirectory" id="--diagnostic-dirdirectory">#</a></span><a aria-hidden="true" class="legacy" id="cli_diagnostic_dir_directory"></a></h4> 805<p>Set the directory to which all diagnostic output files are written. 806Defaults to current working directory.</p> 807<p>Affects the default output directory of:</p> 808<ul> 809<li><a href="#--cpu-prof-dir"><code>--cpu-prof-dir</code></a></li> 810<li><a href="#--heap-prof-dir"><code>--heap-prof-dir</code></a></li> 811<li><a href="#--redirect-warningsfile"><code>--redirect-warnings</code></a></li> 812</ul> 813<h4><code>--disable-proto=mode</code><span><a class="mark" href="#--disable-protomode" id="--disable-protomode">#</a></span><a aria-hidden="true" class="legacy" id="cli_disable_proto_mode"></a></h4> 814<div class="api_metadata"> 815<span>Added in: v13.12.0, v12.17.0</span> 816</div> 817<p>Disable the <code>Object.prototype.__proto__</code> property. If <code>mode</code> is <code>delete</code>, the 818property is removed entirely. If <code>mode</code> is <code>throw</code>, accesses to the 819property throw an exception with the code <code>ERR_PROTO_ACCESS</code>.</p> 820<h4><code>--disallow-code-generation-from-strings</code><span><a class="mark" href="#--disallow-code-generation-from-strings" id="--disallow-code-generation-from-strings">#</a></span><a aria-hidden="true" class="legacy" id="cli_disallow_code_generation_from_strings"></a></h4> 821<div class="api_metadata"> 822<span>Added in: v9.8.0</span> 823</div> 824<p>Make built-in language features like <code>eval</code> and <code>new Function</code> that generate 825code from strings throw an exception instead. This does not affect the Node.js 826<code>node:vm</code> module.</p> 827<h4><code>--dns-result-order=order</code><span><a class="mark" href="#--dns-result-orderorder" id="--dns-result-orderorder">#</a></span><a aria-hidden="true" class="legacy" id="cli_dns_result_order_order"></a></h4> 828<div class="api_metadata"> 829<details class="changelog"><summary>History</summary> 830<table> 831<tbody><tr><th>Version</th><th>Changes</th></tr> 832<tr><td>v17.0.0</td> 833<td><p>Changed default value to <code>verbatim</code>.</p></td></tr> 834<tr><td>v16.4.0, v14.18.0</td> 835<td><p><span>Added in: v16.4.0, v14.18.0</span></p></td></tr> 836</tbody></table> 837</details> 838</div> 839<p>Set the default value of <code>verbatim</code> in <a href="dns.html#dnslookuphostname-options-callback"><code>dns.lookup()</code></a> and 840<a href="dns.html#dnspromiseslookuphostname-options"><code>dnsPromises.lookup()</code></a>. The value could be:</p> 841<ul> 842<li><code>ipv4first</code>: sets default <code>verbatim</code> <code>false</code>.</li> 843<li><code>verbatim</code>: sets default <code>verbatim</code> <code>true</code>.</li> 844</ul> 845<p>The default is <code>verbatim</code> and <a href="dns.html#dnssetdefaultresultorderorder"><code>dns.setDefaultResultOrder()</code></a> have higher 846priority than <code>--dns-result-order</code>.</p> 847<h4><code>--enable-fips</code><span><a class="mark" href="#--enable-fips" id="--enable-fips">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_fips"></a></h4> 848<div class="api_metadata"> 849<span>Added in: v6.0.0</span> 850</div> 851<p>Enable FIPS-compliant crypto at startup. (Requires Node.js to be built 852against FIPS-compatible OpenSSL.)</p> 853<h4><code>--enable-network-family-autoselection</code><span><a class="mark" href="#--enable-network-family-autoselection" id="--enable-network-family-autoselection">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_network_family_autoselection"></a></h4> 854<div class="api_metadata"> 855<span>Added in: v18.18.0</span> 856</div> 857<p>Enables the family autoselection algorithm unless connection options explicitly 858disables it.</p> 859<h4><code>--enable-source-maps</code><span><a class="mark" href="#--enable-source-maps" id="--enable-source-maps">#</a></span><a aria-hidden="true" class="legacy" id="cli_enable_source_maps"></a></h4> 860<div class="api_metadata"> 861<details class="changelog"><summary>History</summary> 862<table> 863<tbody><tr><th>Version</th><th>Changes</th></tr> 864<tr><td>v15.11.0, v14.18.0</td> 865<td><p>This API is no longer experimental.</p></td></tr> 866<tr><td>v12.12.0</td> 867<td><p><span>Added in: v12.12.0</span></p></td></tr> 868</tbody></table> 869</details> 870</div> 871<p>Enable <a href="https://sourcemaps.info/spec.html">Source Map v3</a> support for stack traces.</p> 872<p>When using a transpiler, such as TypeScript, stack traces thrown by an 873application reference the transpiled code, not the original source position. 874<code>--enable-source-maps</code> enables caching of Source Maps and makes a best 875effort to report stack traces relative to the original source file.</p> 876<p>Overriding <code>Error.prepareStackTrace</code> prevents <code>--enable-source-maps</code> from 877modifying the stack trace.</p> 878<p>Note, enabling source maps can introduce latency to your application 879when <code>Error.stack</code> is accessed. If you access <code>Error.stack</code> frequently 880in your application, take into account the performance implications 881of <code>--enable-source-maps</code>.</p> 882<h4><code>--experimental-global-customevent</code><span><a class="mark" href="#--experimental-global-customevent" id="--experimental-global-customevent">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_global_customevent"></a></h4> 883<div class="api_metadata"> 884<span>Added in: v18.7.0</span> 885</div> 886<p>Expose the <a href="https://dom.spec.whatwg.org/#customevent">CustomEvent Web API</a> on the global scope.</p> 887<h4><code>--experimental-global-webcrypto</code><span><a class="mark" href="#--experimental-global-webcrypto" id="--experimental-global-webcrypto">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_global_webcrypto"></a></h4> 888<div class="api_metadata"> 889<span>Added in: v17.6.0</span> 890</div> 891<p>Expose the <a href="webcrypto.html">Web Crypto API</a> on the global scope.</p> 892<h4><code>--experimental-default-type=type</code><span><a class="mark" href="#--experimental-default-typetype" id="--experimental-default-typetype">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_default_type_type"></a></h4> 893<div class="api_metadata"> 894<span>Added in: v18.19.0</span> 895</div> 896<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a>.0 - Early development</div><p></p> 897<p>Define which module system, <code>module</code> or <code>commonjs</code>, to use for the following:</p> 898<ul> 899<li> 900<p>String input provided via <code>--eval</code> or STDIN, if <code>--input-type</code> is unspecified.</p> 901</li> 902<li> 903<p>Files ending in <code>.js</code> or with no extension, if there is no <code>package.json</code> file 904present in the same folder or any parent folder.</p> 905</li> 906<li> 907<p>Files ending in <code>.js</code> or with no extension, if the nearest parent 908<code>package.json</code> field lacks a <code>"type"</code> field; unless the <code>package.json</code> folder 909or any parent folder is inside a <code>node_modules</code> folder.</p> 910</li> 911</ul> 912<p>In other words, <code>--experimental-default-type=module</code> flips all the places where 913Node.js currently defaults to CommonJS to instead default to ECMAScript modules, 914with the exception of folders and subfolders below <code>node_modules</code>, for backward 915compatibility.</p> 916<p>Under <code>--experimental-default-type=module</code> and <code>--experimental-wasm-modules</code>, 917files with no extension will be treated as WebAssembly if they begin with the 918WebAssembly magic number (<code>\0asm</code>); otherwise they will be treated as ES module 919JavaScript.</p> 920<h4><code>--experimental-import-meta-resolve</code><span><a class="mark" href="#--experimental-import-meta-resolve" id="--experimental-import-meta-resolve">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_import_meta_resolve"></a></h4> 921<div class="api_metadata"> 922<details class="changelog"><summary>History</summary> 923<table> 924<tbody><tr><th>Version</th><th>Changes</th></tr> 925<tr><td>v18.19.0</td> 926<td><p>synchronous import.meta.resolve made available by default, with the flag retained for enabling the experimental second argument as previously supported.</p></td></tr> 927<tr><td>v13.9.0, v12.16.2</td> 928<td><p><span>Added in: v13.9.0, v12.16.2</span></p></td></tr> 929</tbody></table> 930</details> 931</div> 932<p>Enable experimental <code>import.meta.resolve()</code> parent URL support, which allows 933passing a second <code>parentURL</code> argument for contextual resolution.</p> 934<p>Previously gated the entire <code>import.meta.resolve</code> feature.</p> 935<h4><code>--experimental-loader=module</code><span><a class="mark" href="#--experimental-loadermodule" id="--experimental-loadermodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_loader_module"></a></h4> 936<div class="api_metadata"> 937<details class="changelog"><summary>History</summary> 938<table> 939<tbody><tr><th>Version</th><th>Changes</th></tr> 940<tr><td>v12.11.1</td> 941<td><p>This flag was renamed from <code>--loader</code> to <code>--experimental-loader</code>.</p></td></tr> 942<tr><td>v8.8.0</td> 943<td><p><span>Added in: v8.8.0</span></p></td></tr> 944</tbody></table> 945</details> 946</div> 947<blockquote> 948<p>This flag is discouraged and may be removed in a future version of Node.js. 949Please use 950<a href="module.html#enabling"><code>--import</code> with <code>register()</code></a> instead.</p> 951</blockquote> 952<p>Specify the <code>module</code> containing exported <a href="module.html#customization-hooks">module customization hooks</a>. 953<code>module</code> may be any string accepted as an <a href="esm.html#import-specifiers"><code>import</code> specifier</a>.</p> 954<h4><code>--experimental-network-imports</code><span><a class="mark" href="#--experimental-network-imports" id="--experimental-network-imports">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_network_imports"></a></h4> 955<div class="api_metadata"> 956<span>Added in: v17.6.0</span> 957</div> 958<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 959<p>Enable experimental support for the <code>https:</code> protocol in <code>import</code> specifiers.</p> 960<h4><code>--experimental-policy</code><span><a class="mark" href="#--experimental-policy" id="--experimental-policy">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_policy"></a></h4> 961<div class="api_metadata"> 962<span>Added in: v11.8.0</span> 963</div> 964<p>Use the specified file as a security policy.</p> 965<h4><code>--no-experimental-fetch</code><span><a class="mark" href="#--no-experimental-fetch" id="--no-experimental-fetch">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_fetch"></a></h4> 966<div class="api_metadata"> 967<span>Added in: v18.0.0</span> 968</div> 969<p>Disable experimental support for the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a>.</p> 970<h4><code>--no-experimental-repl-await</code><span><a class="mark" href="#--no-experimental-repl-await" id="--no-experimental-repl-await">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_experimental_repl_await"></a></h4> 971<div class="api_metadata"> 972<span>Added in: v16.6.0</span> 973</div> 974<p>Use this flag to disable top-level await in REPL.</p> 975<h4><code>--experimental-shadow-realm</code><span><a class="mark" href="#--experimental-shadow-realm" id="--experimental-shadow-realm">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_shadow_realm"></a></h4> 976<div class="api_metadata"> 977<span>Added in: v18.13.0</span> 978</div> 979<p>Use this flag to enable <a href="https://github.com/tc39/proposal-shadowrealm">ShadowRealm</a> support.</p> 980<h4><code>--experimental-specifier-resolution=mode</code><span><a class="mark" href="#--experimental-specifier-resolutionmode" id="--experimental-specifier-resolutionmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_specifier_resolution_mode"></a></h4> 981<div class="api_metadata"> 982<span>Added in: v13.4.0, v12.16.0</span> 983</div> 984<p>Sets the resolution algorithm for resolving ES module specifiers. Valid options 985are <code>explicit</code> and <code>node</code>.</p> 986<p>The default is <code>explicit</code>, which requires providing the full path to a 987module. The <code>node</code> mode enables support for optional file extensions and 988the ability to import a directory that has an index file.</p> 989<p>See <a href="esm.html#customizing-esm-specifier-resolution-algorithm">customizing ESM specifier resolution</a> for example usage.</p> 990<h4><code>--experimental-test-coverage</code><span><a class="mark" href="#--experimental-test-coverage" id="--experimental-test-coverage">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_test_coverage"></a></h4> 991<div class="api_metadata"> 992<details class="changelog"><summary>History</summary> 993<table> 994<tbody><tr><th>Version</th><th>Changes</th></tr> 995<tr><td>v18.17.0</td> 996<td><p>This option can be used with <code>--test</code>.</p></td></tr> 997<tr><td>v18.15.0</td> 998<td><p><span>Added in: v18.15.0</span></p></td></tr> 999</tbody></table> 1000</details> 1001</div> 1002<p>When used in conjunction with the <code>node:test</code> module, a code coverage report is 1003generated as part of the test runner output. If no tests are run, a coverage 1004report is not generated. See the documentation on 1005<a href="test.html#collecting-code-coverage">collecting code coverage from tests</a> for more details.</p> 1006<h4><code>--experimental-vm-modules</code><span><a class="mark" href="#--experimental-vm-modules" id="--experimental-vm-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_vm_modules"></a></h4> 1007<div class="api_metadata"> 1008<span>Added in: v9.6.0</span> 1009</div> 1010<p>Enable experimental ES Module support in the <code>node:vm</code> module.</p> 1011<h4><code>--experimental-wasi-unstable-preview1</code><span><a class="mark" href="#--experimental-wasi-unstable-preview1" id="--experimental-wasi-unstable-preview1">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_wasi_unstable_preview1"></a></h4> 1012<div class="api_metadata"> 1013<details class="changelog"><summary>History</summary> 1014<table> 1015<tbody><tr><th>Version</th><th>Changes</th></tr> 1016<tr><td>v18.17.0</td> 1017<td><p>This option is no longer required as WASI is enabled by default, but can still be passed.</p></td></tr> 1018<tr><td>v13.6.0</td> 1019<td><p>changed from <code>--experimental-wasi-unstable-preview0</code> to <code>--experimental-wasi-unstable-preview1</code>.</p></td></tr> 1020<tr><td>v13.3.0, v12.16.0</td> 1021<td><p><span>Added in: v13.3.0, v12.16.0</span></p></td></tr> 1022</tbody></table> 1023</details> 1024</div> 1025<p>Enable experimental WebAssembly System Interface (WASI) support.</p> 1026<h4><code>--experimental-wasm-modules</code><span><a class="mark" href="#--experimental-wasm-modules" id="--experimental-wasm-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_experimental_wasm_modules"></a></h4> 1027<div class="api_metadata"> 1028<span>Added in: v12.3.0</span> 1029</div> 1030<p>Enable experimental WebAssembly module support.</p> 1031<h4><code>--force-context-aware</code><span><a class="mark" href="#--force-context-aware" id="--force-context-aware">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_context_aware"></a></h4> 1032<div class="api_metadata"> 1033<span>Added in: v12.12.0</span> 1034</div> 1035<p>Disable loading native addons that are not <a href="addons.html#context-aware-addons">context-aware</a>.</p> 1036<h4><code>--force-fips</code><span><a class="mark" href="#--force-fips" id="--force-fips">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_fips"></a></h4> 1037<div class="api_metadata"> 1038<span>Added in: v6.0.0</span> 1039</div> 1040<p>Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) 1041(Same requirements as <code>--enable-fips</code>.)</p> 1042<h4><code>--frozen-intrinsics</code><span><a class="mark" href="#--frozen-intrinsics" id="--frozen-intrinsics">#</a></span><a aria-hidden="true" class="legacy" id="cli_frozen_intrinsics"></a></h4> 1043<div class="api_metadata"> 1044<span>Added in: v11.12.0</span> 1045</div> 1046<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1047<p>Enable experimental frozen intrinsics like <code>Array</code> and <code>Object</code>.</p> 1048<p>Only the root context is supported. There is no guarantee that 1049<code>globalThis.Array</code> is indeed the default intrinsic reference. Code may break 1050under this flag.</p> 1051<p>To allow polyfills to be added, 1052<a href="#-r---require-module"><code>--require</code></a> and <a href="#--importmodule"><code>--import</code></a> both run before freezing intrinsics.</p> 1053<h4><code>--force-node-api-uncaught-exceptions-policy</code><span><a class="mark" href="#--force-node-api-uncaught-exceptions-policy" id="--force-node-api-uncaught-exceptions-policy">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_node_api_uncaught_exceptions_policy"></a></h4> 1054<div class="api_metadata"> 1055<span>Added in: v18.3.0</span> 1056</div> 1057<p>Enforces <code>uncaughtException</code> event on Node-API asynchronous callbacks.</p> 1058<p>To prevent from an existing add-on from crashing the process, this flag is not 1059enabled by default. In the future, this flag will be enabled by default to 1060enforce the correct behavior.</p> 1061<h4><code>--heapsnapshot-near-heap-limit=max_count</code><span><a class="mark" href="#--heapsnapshot-near-heap-limitmax_count" id="--heapsnapshot-near-heap-limitmax_count">#</a></span><a aria-hidden="true" class="legacy" id="cli_heapsnapshot_near_heap_limit_max_count"></a></h4> 1062<div class="api_metadata"> 1063<span>Added in: v15.1.0, v14.18.0</span> 1064</div> 1065<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1066<p>Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the 1067heap limit. <code>count</code> should be a non-negative integer (in which case 1068Node.js will write no more than <code>max_count</code> snapshots to disk).</p> 1069<p>When generating snapshots, garbage collection may be triggered and bring 1070the heap usage down. Therefore multiple snapshots may be written to disk 1071before the Node.js instance finally runs out of memory. These heap snapshots 1072can be compared to determine what objects are being allocated during the 1073time consecutive snapshots are taken. It's not guaranteed that Node.js will 1074write exactly <code>max_count</code> snapshots to disk, but it will try 1075its best to generate at least one and up to <code>max_count</code> snapshots before the 1076Node.js instance runs out of memory when <code>max_count</code> is greater than <code>0</code>.</p> 1077<p>Generating V8 snapshots takes time and memory (both memory managed by the 1078V8 heap and native memory outside the V8 heap). The bigger the heap is, 1079the more resources it needs. Node.js will adjust the V8 heap to accommodate 1080the additional V8 heap memory overhead, and try its best to avoid using up 1081all the memory available to the process. When the process uses 1082more memory than the system deems appropriate, the process may be terminated 1083abruptly by the system, depending on the system configuration.</p> 1084<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js</span> 1085Wrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot 1086Wrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot 1087Wrote snapshot to Heap.20200430.100038.49580.0.003.heapsnapshot 1088 1089<--- Last few GCs ---> 1090 1091[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 1092[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 1093 1094 1095<--- JS stacktrace ---> 1096 1097FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1098....</code> <button class="copy-button">copy</button></pre> 1099<h4><code>--heapsnapshot-signal=signal</code><span><a class="mark" href="#--heapsnapshot-signalsignal" id="--heapsnapshot-signalsignal">#</a></span><a aria-hidden="true" class="legacy" id="cli_heapsnapshot_signal_signal"></a></h4> 1100<div class="api_metadata"> 1101<span>Added in: v12.0.0</span> 1102</div> 1103<p>Enables a signal handler that causes the Node.js process to write a heap dump 1104when the specified signal is received. <code>signal</code> must be a valid signal name. 1105Disabled by default.</p> 1106<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --heapsnapshot-signal=SIGUSR2 index.js &</span> 1107<span class="hljs-meta prompt_">$ </span><span class="language-bash">ps aux</span> 1108USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1109node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js 1110<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">kill</span> -USR2 1</span> 1111<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span></span> 1112Heap.20190718.133405.15554.0.001.heapsnapshot</code> <button class="copy-button">copy</button></pre> 1113<h4><code>--heap-prof</code><span><a class="mark" href="#--heap-prof" id="--heap-prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof"></a></h4> 1114<div class="api_metadata"> 1115<span>Added in: v12.4.0</span> 1116</div> 1117<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1118<p>Starts the V8 heap profiler on start up, and writes the heap profile to disk 1119before exit.</p> 1120<p>If <code>--heap-prof-dir</code> is not specified, the generated profile is placed 1121in the current working directory.</p> 1122<p>If <code>--heap-prof-name</code> is not specified, the generated profile is 1123named <code>Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile</code>.</p> 1124<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --heap-prof index.js</span> 1125<span class="hljs-meta prompt_">$ </span><span class="language-bash"><span class="hljs-built_in">ls</span> *.heapprofile</span> 1126Heap.20190409.202950.15293.0.001.heapprofile</code> <button class="copy-button">copy</button></pre> 1127<h4><code>--heap-prof-dir</code><span><a class="mark" href="#--heap-prof-dir" id="--heap-prof-dir">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_dir"></a></h4> 1128<div class="api_metadata"> 1129<span>Added in: v12.4.0</span> 1130</div> 1131<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1132<p>Specify the directory where the heap profiles generated by <code>--heap-prof</code> will 1133be placed.</p> 1134<p>The default value is controlled by the 1135<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p> 1136<h4><code>--heap-prof-interval</code><span><a class="mark" href="#--heap-prof-interval" id="--heap-prof-interval">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_interval"></a></h4> 1137<div class="api_metadata"> 1138<span>Added in: v12.4.0</span> 1139</div> 1140<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1141<p>Specify the average sampling interval in bytes for the heap profiles generated 1142by <code>--heap-prof</code>. The default is 512 * 1024 bytes.</p> 1143<h4><code>--heap-prof-name</code><span><a class="mark" href="#--heap-prof-name" id="--heap-prof-name">#</a></span><a aria-hidden="true" class="legacy" id="cli_heap_prof_name"></a></h4> 1144<div class="api_metadata"> 1145<span>Added in: v12.4.0</span> 1146</div> 1147<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1148<p>Specify the file name of the heap profile generated by <code>--heap-prof</code>.</p> 1149<h4><code>--icu-data-dir=file</code><span><a class="mark" href="#--icu-data-dirfile" id="--icu-data-dirfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_icu_data_dir_file"></a></h4> 1150<div class="api_metadata"> 1151<span>Added in: v0.11.15</span> 1152</div> 1153<p>Specify ICU data load path. (Overrides <code>NODE_ICU_DATA</code>.)</p> 1154<h4><code>--import=module</code><span><a class="mark" href="#--importmodule" id="--importmodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_import_module"></a></h4> 1155<div class="api_metadata"> 1156<span>Added in: v18.18.0</span> 1157</div> 1158<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1159<p>Preload the specified module at startup.</p> 1160<p>Follows <a href="esm.html#modules-ecmascript-modules">ECMAScript module</a> resolution rules. 1161Use <a href="#-r---require-module"><code>--require</code></a> to load a <a href="modules.html">CommonJS module</a>. 1162Modules preloaded with <code>--require</code> will run before modules preloaded with <code>--import</code>.</p> 1163<h4><code>--input-type=type</code><span><a class="mark" href="#--input-typetype" id="--input-typetype">#</a></span><a aria-hidden="true" class="legacy" id="cli_input_type_type"></a></h4> 1164<div class="api_metadata"> 1165<span>Added in: v12.0.0</span> 1166</div> 1167<p>This configures Node.js to interpret string input as CommonJS or as an ES 1168module. String input is input via <code>--eval</code>, <code>--print</code>, or <code>STDIN</code>.</p> 1169<p>Valid values are <code>"commonjs"</code> and <code>"module"</code>. The default is <code>"commonjs"</code>.</p> 1170<p>The REPL does not support this option.</p> 1171<h4><code>--inspect-brk[=[host:]port]</code><span><a class="mark" href="#--inspect-brkhostport" id="--inspect-brkhostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_brk_host_port"></a></h4> 1172<div class="api_metadata"> 1173<span>Added in: v7.6.0</span> 1174</div> 1175<p>Activate inspector on <code>host:port</code> and break at start of user script. 1176Default <code>host:port</code> is <code>127.0.0.1:9229</code>.</p> 1177<h4><code>--inspect-port=[host:]port</code><span><a class="mark" href="#--inspect-porthostport" id="--inspect-porthostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_port_host_port"></a></h4> 1178<div class="api_metadata"> 1179<span>Added in: v7.6.0</span> 1180</div> 1181<p>Set the <code>host:port</code> to be used when the inspector is activated. 1182Useful when activating the inspector by sending the <code>SIGUSR1</code> signal.</p> 1183<p>Default host is <code>127.0.0.1</code>.</p> 1184<p>See the <a href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure">security warning</a> below regarding the <code>host</code> 1185parameter usage.</p> 1186<h4><code>--inspect[=[host:]port]</code><span><a class="mark" href="#--inspecthostport" id="--inspecthostport">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_host_port"></a></h4> 1187<div class="api_metadata"> 1188<span>Added in: v6.3.0</span> 1189</div> 1190<p>Activate inspector on <code>host:port</code>. Default is <code>127.0.0.1:9229</code>.</p> 1191<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug 1192and profile Node.js instances. The tools attach to Node.js instances via a 1193tcp port and communicate using the <a href="https://chromedevtools.github.io/devtools-protocol/">Chrome DevTools Protocol</a>.</p> 1194<!-- Anchor to make sure old links find a target --> 1195<p><a id="inspector_security"></a></p> 1196<h5>Warning: binding inspector to a public IP:port combination is insecure<span><a class="mark" href="#warning-binding-inspector-to-a-public-ipport-combination-is-insecure" id="warning-binding-inspector-to-a-public-ipport-combination-is-insecure">#</a></span><a aria-hidden="true" class="legacy" id="cli_warning_binding_inspector_to_a_public_ip_port_combination_is_insecure"></a></h5> 1197<p>Binding the inspector to a public IP (including <code>0.0.0.0</code>) with an open port is 1198insecure, as it allows external hosts to connect to the inspector and perform 1199a <a href="https://www.owasp.org/index.php/Code_Injection">remote code execution</a> attack.</p> 1200<p>If specifying a host, make sure that either:</p> 1201<ul> 1202<li>The host is not accessible from public networks.</li> 1203<li>A firewall disallows unwanted connections on the port.</li> 1204</ul> 1205<p><strong>More specifically, <code>--inspect=0.0.0.0</code> is insecure if the port (<code>9229</code> by 1206default) is not firewall-protected.</strong></p> 1207<p>See the <a href="https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications">debugging security implications</a> section for more information.</p> 1208<h4><code>--inspect-publish-uid=stderr,http</code><span><a class="mark" href="#--inspect-publish-uidstderrhttp" id="--inspect-publish-uidstderrhttp">#</a></span><a aria-hidden="true" class="legacy" id="cli_inspect_publish_uid_stderr_http"></a></h4> 1209<p>Specify ways of the inspector web socket url exposure.</p> 1210<p>By default inspector websocket url is available in stderr and under <code>/json/list</code> 1211endpoint on <code>http://host:port/json/list</code>.</p> 1212<h4><code>--insecure-http-parser</code><span><a class="mark" href="#--insecure-http-parser" id="--insecure-http-parser">#</a></span><a aria-hidden="true" class="legacy" id="cli_insecure_http_parser"></a></h4> 1213<div class="api_metadata"> 1214<span>Added in: v13.4.0, v12.15.0, v10.19.0</span> 1215</div> 1216<p>Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow 1217interoperability with non-conformant HTTP implementations. It may also allow 1218request smuggling and other HTTP attacks that rely on invalid headers being 1219accepted. Avoid using this option.</p> 1220<h4><code>--jitless</code><span><a class="mark" href="#--jitless" id="--jitless">#</a></span><a aria-hidden="true" class="legacy" id="cli_jitless"></a></h4> 1221<div class="api_metadata"> 1222<span>Added in: v12.0.0</span> 1223</div> 1224<p>Disable <a href="https://v8.dev/blog/jitless">runtime allocation of executable memory</a>. This may be 1225required on some platforms for security reasons. It can also reduce attack 1226surface on other platforms, but the performance impact may be severe.</p> 1227<p>This flag is inherited from V8 and is subject to change upstream. It may 1228disappear in a non-semver-major release.</p> 1229<h4><code>--max-http-header-size=size</code><span><a class="mark" href="#--max-http-header-sizesize" id="--max-http-header-sizesize">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_http_header_size_size"></a></h4> 1230<div class="api_metadata"> 1231<details class="changelog"><summary>History</summary> 1232<table> 1233<tbody><tr><th>Version</th><th>Changes</th></tr> 1234<tr><td>v13.13.0</td> 1235<td><p>Change maximum default size of HTTP headers from 8 KiB to 16 KiB.</p></td></tr> 1236<tr><td>v11.6.0, v10.15.0</td> 1237<td><p><span>Added in: v11.6.0, v10.15.0</span></p></td></tr> 1238</tbody></table> 1239</details> 1240</div> 1241<p>Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.</p> 1242<h4><code>--napi-modules</code><span><a class="mark" href="#--napi-modules" id="--napi-modules">#</a></span><a aria-hidden="true" class="legacy" id="cli_napi_modules"></a></h4> 1243<div class="api_metadata"> 1244<span>Added in: v7.10.0</span> 1245</div> 1246<p>This option is a no-op. It is kept for compatibility.</p> 1247<h4><code>--no-addons</code><span><a class="mark" href="#--no-addons" id="--no-addons">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_addons"></a></h4> 1248<div class="api_metadata"> 1249<span>Added in: v16.10.0, v14.19.0</span> 1250</div> 1251<p>Disable the <code>node-addons</code> exports condition as well as disable loading 1252native addons. When <code>--no-addons</code> is specified, calling <code>process.dlopen</code> or 1253requiring a native C++ addon will fail and throw an exception.</p> 1254<h4><code>--no-deprecation</code><span><a class="mark" href="#--no-deprecation" id="--no-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_deprecation"></a></h4> 1255<div class="api_metadata"> 1256<span>Added in: v0.8.0</span> 1257</div> 1258<p>Silence deprecation warnings.</p> 1259<h4><code>--no-extra-info-on-fatal-exception</code><span><a class="mark" href="#--no-extra-info-on-fatal-exception" id="--no-extra-info-on-fatal-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_extra_info_on_fatal_exception"></a></h4> 1260<div class="api_metadata"> 1261<span>Added in: v17.0.0</span> 1262</div> 1263<p>Hide extra information on fatal exception that causes exit.</p> 1264<h4><code>--no-force-async-hooks-checks</code><span><a class="mark" href="#--no-force-async-hooks-checks" id="--no-force-async-hooks-checks">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_force_async_hooks_checks"></a></h4> 1265<div class="api_metadata"> 1266<span>Added in: v9.0.0</span> 1267</div> 1268<p>Disables runtime checks for <code>async_hooks</code>. These will still be enabled 1269dynamically when <code>async_hooks</code> is enabled.</p> 1270<h4><code>--no-global-search-paths</code><span><a class="mark" href="#--no-global-search-paths" id="--no-global-search-paths">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_global_search_paths"></a></h4> 1271<div class="api_metadata"> 1272<span>Added in: v16.10.0</span> 1273</div> 1274<p>Do not search modules from global paths like <code>$HOME/.node_modules</code> and 1275<code>$NODE_PATH</code>.</p> 1276<h4><code>--no-warnings</code><span><a class="mark" href="#--no-warnings" id="--no-warnings">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_warnings"></a></h4> 1277<div class="api_metadata"> 1278<span>Added in: v6.0.0</span> 1279</div> 1280<p>Silence all process warnings (including deprecations).</p> 1281<h4><code>--node-memory-debug</code><span><a class="mark" href="#--node-memory-debug" id="--node-memory-debug">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_memory_debug"></a></h4> 1282<div class="api_metadata"> 1283<span>Added in: v15.0.0, v14.18.0</span> 1284</div> 1285<p>Enable extra debug checks for memory leaks in Node.js internals. This is 1286usually only useful for developers debugging Node.js itself.</p> 1287<h4><code>--openssl-config=file</code><span><a class="mark" href="#--openssl-configfile" id="--openssl-configfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_config_file"></a></h4> 1288<div class="api_metadata"> 1289<span>Added in: v6.9.0</span> 1290</div> 1291<p>Load an OpenSSL configuration file on startup. Among other uses, this can be 1292used to enable FIPS-compliant crypto if Node.js is built 1293against FIPS-enabled OpenSSL.</p> 1294<h4><code>--openssl-shared-config</code><span><a class="mark" href="#--openssl-shared-config" id="--openssl-shared-config">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_shared_config"></a></h4> 1295<div class="api_metadata"> 1296<span>Added in: v18.5.0</span> 1297</div> 1298<p>Enable OpenSSL default configuration section, <code>openssl_conf</code> to be read from 1299the OpenSSL configuration file. The default configuration file is named 1300<code>openssl.cnf</code> but this can be changed using the environment variable 1301<code>OPENSSL_CONF</code>, or by using the command line option <code>--openssl-config</code>. 1302The location of the default OpenSSL configuration file depends on how OpenSSL 1303is being linked to Node.js. Sharing the OpenSSL configuration may have unwanted 1304implications and it is recommended to use a configuration section specific to 1305Node.js which is <code>nodejs_conf</code> and is default when this option is not used.</p> 1306<h4><code>--openssl-legacy-provider</code><span><a class="mark" href="#--openssl-legacy-provider" id="--openssl-legacy-provider">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_legacy_provider"></a></h4> 1307<div class="api_metadata"> 1308<span>Added in: v17.0.0</span> 1309</div> 1310<p>Enable OpenSSL 3.0 legacy provider. For more information please see 1311<a href="https://www.openssl.org/docs/man3.0/man7/OSSL_PROVIDER-legacy.html">OSSL_PROVIDER-legacy</a>.</p> 1312<h4><code>--pending-deprecation</code><span><a class="mark" href="#--pending-deprecation" id="--pending-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_pending_deprecation"></a></h4> 1313<div class="api_metadata"> 1314<span>Added in: v8.0.0</span> 1315</div> 1316<p>Emit pending deprecation warnings.</p> 1317<p>Pending deprecations are generally identical to a runtime deprecation with the 1318notable exception that they are turned <em>off</em> by default and will not be emitted 1319unless either the <code>--pending-deprecation</code> command-line flag, or the 1320<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations 1321are used to provide a kind of selective "early warning" mechanism that 1322developers may leverage to detect deprecated API usage.</p> 1323<h4><code>--policy-integrity=sri</code><span><a class="mark" href="#--policy-integritysri" id="--policy-integritysri">#</a></span><a aria-hidden="true" class="legacy" id="cli_policy_integrity_sri"></a></h4> 1324<div class="api_metadata"> 1325<span>Added in: v12.7.0</span> 1326</div> 1327<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1328<p>Instructs Node.js to error prior to running any code if the policy does not have 1329the specified integrity. It expects a <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity">Subresource Integrity</a> string as a 1330parameter.</p> 1331<h4><code>--preserve-symlinks</code><span><a class="mark" href="#--preserve-symlinks" id="--preserve-symlinks">#</a></span><a aria-hidden="true" class="legacy" id="cli_preserve_symlinks"></a></h4> 1332<div class="api_metadata"> 1333<span>Added in: v6.3.0</span> 1334</div> 1335<p>Instructs the module loader to preserve symbolic links when resolving and 1336caching modules.</p> 1337<p>By default, when Node.js loads a module from a path that is symbolically linked 1338to a different on-disk location, Node.js will dereference the link and use the 1339actual on-disk "real path" of the module as both an identifier and as a root 1340path to locate other dependency modules. In most cases, this default behavior 1341is acceptable. However, when using symbolically linked peer dependencies, as 1342illustrated in the example below, the default behavior causes an exception to 1343be thrown if <code>moduleA</code> attempts to require <code>moduleB</code> as a peer dependency:</p> 1344<pre><code class="language-text">{appDir} 1345 ├── app 1346 │ ├── index.js 1347 │ └── node_modules 1348 │ ├── moduleA -> {appDir}/moduleA 1349 │ └── moduleB 1350 │ ├── index.js 1351 │ └── package.json 1352 └── moduleA 1353 ├── index.js 1354 └── package.json</code> <button class="copy-button">copy</button></pre> 1355<p>The <code>--preserve-symlinks</code> command-line flag instructs Node.js to use the 1356symlink path for modules as opposed to the real path, allowing symbolically 1357linked peer dependencies to be found.</p> 1358<p>Note, however, that using <code>--preserve-symlinks</code> can have other side effects. 1359Specifically, symbolically linked <em>native</em> modules can fail to load if those 1360are linked from more than one location in the dependency tree (Node.js would 1361see those as two separate modules and would attempt to load the module multiple 1362times, causing an exception to be thrown).</p> 1363<p>The <code>--preserve-symlinks</code> flag does not apply to the main module, which allows 1364<code>node --preserve-symlinks node_module/.bin/<foo></code> to work. To apply the same 1365behavior for the main module, also use <code>--preserve-symlinks-main</code>.</p> 1366<h4><code>--preserve-symlinks-main</code><span><a class="mark" href="#--preserve-symlinks-main" id="--preserve-symlinks-main">#</a></span><a aria-hidden="true" class="legacy" id="cli_preserve_symlinks_main"></a></h4> 1367<div class="api_metadata"> 1368<span>Added in: v10.2.0</span> 1369</div> 1370<p>Instructs the module loader to preserve symbolic links when resolving and 1371caching the main module (<code>require.main</code>).</p> 1372<p>This flag exists so that the main module can be opted-in to the same behavior 1373that <code>--preserve-symlinks</code> gives to all other imports; they are separate flags, 1374however, for backward compatibility with older Node.js versions.</p> 1375<p><code>--preserve-symlinks-main</code> does not imply <code>--preserve-symlinks</code>; use 1376<code>--preserve-symlinks-main</code> in addition to 1377<code>--preserve-symlinks</code> when it is not desirable to follow symlinks before 1378resolving relative paths.</p> 1379<p>See <a href="#--preserve-symlinks"><code>--preserve-symlinks</code></a> for more information.</p> 1380<h4><code>--prof</code><span><a class="mark" href="#--prof" id="--prof">#</a></span><a aria-hidden="true" class="legacy" id="cli_prof"></a></h4> 1381<div class="api_metadata"> 1382<span>Added in: v2.0.0</span> 1383</div> 1384<p>Generate V8 profiler output.</p> 1385<h4><code>--prof-process</code><span><a class="mark" href="#--prof-process" id="--prof-process">#</a></span><a aria-hidden="true" class="legacy" id="cli_prof_process"></a></h4> 1386<div class="api_metadata"> 1387<span>Added in: v5.2.0</span> 1388</div> 1389<p>Process V8 profiler output generated using the V8 option <code>--prof</code>.</p> 1390<h4><code>--redirect-warnings=file</code><span><a class="mark" href="#--redirect-warningsfile" id="--redirect-warningsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_redirect_warnings_file"></a></h4> 1391<div class="api_metadata"> 1392<span>Added in: v8.0.0</span> 1393</div> 1394<p>Write process warnings to the given file instead of printing to stderr. The 1395file will be created if it does not exist, and will be appended to if it does. 1396If an error occurs while attempting to write the warning to the file, the 1397warning will be written to stderr instead.</p> 1398<p>The <code>file</code> name may be an absolute path. If it is not, the default directory it 1399will be written to is controlled by the 1400<a href="#--diagnostic-dirdirectory"><code>--diagnostic-dir</code></a> command-line option.</p> 1401<h4><code>--report-compact</code><span><a class="mark" href="#--report-compact" id="--report-compact">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_compact"></a></h4> 1402<div class="api_metadata"> 1403<span>Added in: v13.12.0, v12.17.0</span> 1404</div> 1405<p>Write reports in a compact format, single-line JSON, more easily consumable 1406by log processing systems than the default multi-line format designed for 1407human consumption.</p> 1408<h4><code>--report-dir=directory</code>, <code>report-directory=directory</code><span><a class="mark" href="#--report-dirdirectory-report-directorydirectory" id="--report-dirdirectory-report-directorydirectory">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_dir_directory_report_directory_directory"></a></h4> 1409<div class="api_metadata"> 1410<details class="changelog"><summary>History</summary> 1411<table> 1412<tbody><tr><th>Version</th><th>Changes</th></tr> 1413<tr><td>v13.12.0, v12.17.0</td> 1414<td><p>This option is no longer experimental.</p></td></tr> 1415<tr><td>v12.0.0</td> 1416<td><p>Changed from <code>--diagnostic-report-directory</code> to <code>--report-directory</code>.</p></td></tr> 1417<tr><td>v11.8.0</td> 1418<td><p><span>Added in: v11.8.0</span></p></td></tr> 1419</tbody></table> 1420</details> 1421</div> 1422<p>Location at which the report will be generated.</p> 1423<h4><code>--report-filename=filename</code><span><a class="mark" href="#--report-filenamefilename" id="--report-filenamefilename">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_filename_filename"></a></h4> 1424<div class="api_metadata"> 1425<details class="changelog"><summary>History</summary> 1426<table> 1427<tbody><tr><th>Version</th><th>Changes</th></tr> 1428<tr><td>v13.12.0, v12.17.0</td> 1429<td><p>This option is no longer experimental.</p></td></tr> 1430<tr><td>v12.0.0</td> 1431<td><p>changed from <code>--diagnostic-report-filename</code> to <code>--report-filename</code>.</p></td></tr> 1432<tr><td>v11.8.0</td> 1433<td><p><span>Added in: v11.8.0</span></p></td></tr> 1434</tbody></table> 1435</details> 1436</div> 1437<p>Name of the file to which the report will be written.</p> 1438<p>If the filename is set to <code>'stdout'</code> or <code>'stderr'</code>, the report is written to 1439the stdout or stderr of the process respectively.</p> 1440<h4><code>--report-on-fatalerror</code><span><a class="mark" href="#--report-on-fatalerror" id="--report-on-fatalerror">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_on_fatalerror"></a></h4> 1441<div class="api_metadata"> 1442<details class="changelog"><summary>History</summary> 1443<table> 1444<tbody><tr><th>Version</th><th>Changes</th></tr> 1445<tr><td>v14.0.0, v13.14.0, v12.17.0</td> 1446<td><p>This option is no longer experimental.</p></td></tr> 1447<tr><td>v12.0.0</td> 1448<td><p>changed from <code>--diagnostic-report-on-fatalerror</code> to <code>--report-on-fatalerror</code>.</p></td></tr> 1449<tr><td>v11.8.0</td> 1450<td><p><span>Added in: v11.8.0</span></p></td></tr> 1451</tbody></table> 1452</details> 1453</div> 1454<p>Enables the report to be triggered on fatal errors (internal errors within 1455the Node.js runtime such as out of memory) that lead to termination of the 1456application. Useful to inspect various diagnostic data elements such as heap, 1457stack, event loop state, resource consumption etc. to reason about the fatal 1458error.</p> 1459<h4><code>--report-on-signal</code><span><a class="mark" href="#--report-on-signal" id="--report-on-signal">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_on_signal"></a></h4> 1460<div class="api_metadata"> 1461<details class="changelog"><summary>History</summary> 1462<table> 1463<tbody><tr><th>Version</th><th>Changes</th></tr> 1464<tr><td>v13.12.0, v12.17.0</td> 1465<td><p>This option is no longer experimental.</p></td></tr> 1466<tr><td>v12.0.0</td> 1467<td><p>changed from <code>--diagnostic-report-on-signal</code> to <code>--report-on-signal</code>.</p></td></tr> 1468<tr><td>v11.8.0</td> 1469<td><p><span>Added in: v11.8.0</span></p></td></tr> 1470</tbody></table> 1471</details> 1472</div> 1473<p>Enables report to be generated upon receiving the specified (or predefined) 1474signal to the running Node.js process. The signal to trigger the report is 1475specified through <code>--report-signal</code>.</p> 1476<h4><code>--report-signal=signal</code><span><a class="mark" href="#--report-signalsignal" id="--report-signalsignal">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_signal_signal"></a></h4> 1477<div class="api_metadata"> 1478<details class="changelog"><summary>History</summary> 1479<table> 1480<tbody><tr><th>Version</th><th>Changes</th></tr> 1481<tr><td>v13.12.0, v12.17.0</td> 1482<td><p>This option is no longer experimental.</p></td></tr> 1483<tr><td>v12.0.0</td> 1484<td><p>changed from <code>--diagnostic-report-signal</code> to <code>--report-signal</code>.</p></td></tr> 1485<tr><td>v11.8.0</td> 1486<td><p><span>Added in: v11.8.0</span></p></td></tr> 1487</tbody></table> 1488</details> 1489</div> 1490<p>Sets or resets the signal for report generation (not supported on Windows). 1491Default signal is <code>SIGUSR2</code>.</p> 1492<h4><code>--report-uncaught-exception</code><span><a class="mark" href="#--report-uncaught-exception" id="--report-uncaught-exception">#</a></span><a aria-hidden="true" class="legacy" id="cli_report_uncaught_exception"></a></h4> 1493<div class="api_metadata"> 1494<details class="changelog"><summary>History</summary> 1495<table> 1496<tbody><tr><th>Version</th><th>Changes</th></tr> 1497<tr><td>v18.8.0</td> 1498<td><p>Report is not generated if the uncaught exception is handled.</p></td></tr> 1499<tr><td>v13.12.0, v12.17.0</td> 1500<td><p>This option is no longer experimental.</p></td></tr> 1501<tr><td>v12.0.0</td> 1502<td><p>changed from <code>--diagnostic-report-uncaught-exception</code> to <code>--report-uncaught-exception</code>.</p></td></tr> 1503<tr><td>v11.8.0</td> 1504<td><p><span>Added in: v11.8.0</span></p></td></tr> 1505</tbody></table> 1506</details> 1507</div> 1508<p>Enables report to be generated when the process exits due to an uncaught 1509exception. Useful when inspecting the JavaScript stack in conjunction with 1510native stack and other runtime environment data.</p> 1511<h4><code>--secure-heap=n</code><span><a class="mark" href="#--secure-heapn" id="--secure-heapn">#</a></span><a aria-hidden="true" class="legacy" id="cli_secure_heap_n"></a></h4> 1512<div class="api_metadata"> 1513<span>Added in: v15.6.0</span> 1514</div> 1515<p>Initializes an OpenSSL secure heap of <code>n</code> bytes. When initialized, the 1516secure heap is used for selected types of allocations within OpenSSL 1517during key generation and other operations. This is useful, for instance, 1518to prevent sensitive information from leaking due to pointer overruns 1519or underruns.</p> 1520<p>The secure heap is a fixed size and cannot be resized at runtime so, 1521if used, it is important to select a large enough heap to cover all 1522application uses.</p> 1523<p>The heap size given must be a power of two. Any value less than 2 1524will disable the secure heap.</p> 1525<p>The secure heap is disabled by default.</p> 1526<p>The secure heap is not available on Windows.</p> 1527<p>See <a href="https://www.openssl.org/docs/man3.0/man3/CRYPTO_secure_malloc_init.html"><code>CRYPTO_secure_malloc_init</code></a> for more details.</p> 1528<h4><code>--secure-heap-min=n</code><span><a class="mark" href="#--secure-heap-minn" id="--secure-heap-minn">#</a></span><a aria-hidden="true" class="legacy" id="cli_secure_heap_min_n"></a></h4> 1529<div class="api_metadata"> 1530<span>Added in: v15.6.0</span> 1531</div> 1532<p>When using <code>--secure-heap</code>, the <code>--secure-heap-min</code> flag specifies the 1533minimum allocation from the secure heap. The minimum value is <code>2</code>. 1534The maximum value is the lesser of <code>--secure-heap</code> or <code>2147483647</code>. 1535The value given must be a power of two.</p> 1536<h4><code>--snapshot-blob=path</code><span><a class="mark" href="#--snapshot-blobpath" id="--snapshot-blobpath">#</a></span><a aria-hidden="true" class="legacy" id="cli_snapshot_blob_path"></a></h4> 1537<div class="api_metadata"> 1538<span>Added in: v18.8.0</span> 1539</div> 1540<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1541<p>When used with <code>--build-snapshot</code>, <code>--snapshot-blob</code> specifies the path 1542where the generated snapshot blob is written to. If not specified, the 1543generated blob is written to <code>snapshot.blob</code> in the current working directory.</p> 1544<p>When used without <code>--build-snapshot</code>, <code>--snapshot-blob</code> specifies the 1545path to the blob that is used to restore the application state.</p> 1546<p>When loading a snapshot, Node.js checks that:</p> 1547<ol> 1548<li>The version, architecture, and platform of the running Node.js binary 1549are exactly the same as that of the binary that generates the snapshot.</li> 1550<li>The V8 flags and CPU features are compatible with that of the binary 1551that generates the snapshot.</li> 1552</ol> 1553<p>If they don't match, Node.js refuses to load the snapshot and exits with 1554status code 1.</p> 1555<h4><code>--test</code><span><a class="mark" href="#--test" id="--test">#</a></span><a aria-hidden="true" class="legacy" id="cli_test"></a></h4> 1556<div class="api_metadata"> 1557<details class="changelog"><summary>History</summary> 1558<table> 1559<tbody><tr><th>Version</th><th>Changes</th></tr> 1560<tr><td>v18.13.0</td> 1561<td><p>Test runner now supports running in watch mode.</p></td></tr> 1562<tr><td>v18.1.0</td> 1563<td><p><span>Added in: v18.1.0</span></p></td></tr> 1564</tbody></table> 1565</details> 1566</div> 1567<p>Starts the Node.js command line test runner. This flag cannot be combined with 1568<code>--watch-path</code>, <code>--check</code>, <code>--eval</code>, <code>--interactive</code>, or the inspector. 1569See the documentation on <a href="test.html#running-tests-from-the-command-line">running tests from the command line</a> 1570for more details.</p> 1571<h4><code>--test-concurrency</code><span><a class="mark" href="#--test-concurrency" id="--test-concurrency">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_concurrency"></a></h4> 1572<div class="api_metadata"> 1573<span>Added in: v18.19.0</span> 1574</div> 1575<p>The maximum number of test files that the test runner CLI will execute 1576concurrently. The default value is <code>os.availableParallelism() - 1</code>.</p> 1577<h4><code>--test-name-pattern</code><span><a class="mark" href="#--test-name-pattern" id="--test-name-pattern">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_name_pattern"></a></h4> 1578<div class="api_metadata"> 1579<span>Added in: v18.11.0</span> 1580</div> 1581<p>A regular expression that configures the test runner to only execute tests 1582whose name matches the provided pattern. See the documentation on 1583<a href="test.html#filtering-tests-by-name">filtering tests by name</a> for more details.</p> 1584<h4><code>--test-reporter</code><span><a class="mark" href="#--test-reporter" id="--test-reporter">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_reporter"></a></h4> 1585<div class="api_metadata"> 1586<span>Added in: v18.15.0</span> 1587</div> 1588<p>A test reporter to use when running tests. See the documentation on 1589<a href="test.html#test-reporters">test reporters</a> for more details.</p> 1590<h4><code>--test-reporter-destination</code><span><a class="mark" href="#--test-reporter-destination" id="--test-reporter-destination">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_reporter_destination"></a></h4> 1591<div class="api_metadata"> 1592<span>Added in: v18.15.0</span> 1593</div> 1594<p>The destination for the corresponding test reporter. See the documentation on 1595<a href="test.html#test-reporters">test reporters</a> for more details.</p> 1596<h4><code>--test-only</code><span><a class="mark" href="#--test-only" id="--test-only">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_only"></a></h4> 1597<div class="api_metadata"> 1598<span>Added in: v18.0.0</span> 1599</div> 1600<p>Configures the test runner to only execute top level tests that have the <code>only</code> 1601option set.</p> 1602<h4><code>--test-shard</code><span><a class="mark" href="#--test-shard" id="--test-shard">#</a></span><a aria-hidden="true" class="legacy" id="cli_test_shard"></a></h4> 1603<div class="api_metadata"> 1604<span>Added in: v18.19.0</span> 1605</div> 1606<p>Test suite shard to execute in a format of <code><index>/<total></code>, where</p> 1607<p><code>index</code> is a positive integer, index of divided parts 1608<code>total</code> is a positive integer, total of divided part 1609This command will divide all tests files into <code>total</code> equal parts, 1610and will run only those that happen to be in an <code>index</code> part.</p> 1611<p>For example, to split your tests suite into three parts, use this:</p> 1612<pre><code class="language-bash">node --<span class="hljs-built_in">test</span> --test-shard=1/3 1613node --<span class="hljs-built_in">test</span> --test-shard=2/3 1614node --<span class="hljs-built_in">test</span> --test-shard=3/3</code> <button class="copy-button">copy</button></pre> 1615<h4><code>--throw-deprecation</code><span><a class="mark" href="#--throw-deprecation" id="--throw-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_throw_deprecation"></a></h4> 1616<div class="api_metadata"> 1617<span>Added in: v0.11.14</span> 1618</div> 1619<p>Throw errors for deprecations.</p> 1620<h4><code>--title=title</code><span><a class="mark" href="#--titletitle" id="--titletitle">#</a></span><a aria-hidden="true" class="legacy" id="cli_title_title"></a></h4> 1621<div class="api_metadata"> 1622<span>Added in: v10.7.0</span> 1623</div> 1624<p>Set <code>process.title</code> on startup.</p> 1625<h4><code>--tls-cipher-list=list</code><span><a class="mark" href="#--tls-cipher-listlist" id="--tls-cipher-listlist">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_cipher_list_list"></a></h4> 1626<div class="api_metadata"> 1627<span>Added in: v4.0.0</span> 1628</div> 1629<p>Specify an alternative default TLS cipher list. Requires Node.js to be built 1630with crypto support (default).</p> 1631<h4><code>--tls-keylog=file</code><span><a class="mark" href="#--tls-keylogfile" id="--tls-keylogfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_keylog_file"></a></h4> 1632<div class="api_metadata"> 1633<span>Added in: v13.2.0, v12.16.0</span> 1634</div> 1635<p>Log TLS key material to a file. The key material is in NSS <code>SSLKEYLOGFILE</code> 1636format and can be used by software (such as Wireshark) to decrypt the TLS 1637traffic.</p> 1638<h4><code>--tls-max-v1.2</code><span><a class="mark" href="#--tls-max-v12" id="--tls-max-v12">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_max_v1_2"></a></h4> 1639<div class="api_metadata"> 1640<span>Added in: v12.0.0, v10.20.0</span> 1641</div> 1642<p>Set <a href="tls.html#tlsdefault_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.2'. Use to disable support for 1643TLSv1.3.</p> 1644<h4><code>--tls-max-v1.3</code><span><a class="mark" href="#--tls-max-v13" id="--tls-max-v13">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_max_v1_3"></a></h4> 1645<div class="api_metadata"> 1646<span>Added in: v12.0.0</span> 1647</div> 1648<p>Set default <a href="tls.html#tlsdefault_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.3'. Use to enable support 1649for TLSv1.3.</p> 1650<h4><code>--tls-min-v1.0</code><span><a class="mark" href="#--tls-min-v10" id="--tls-min-v10">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_0"></a></h4> 1651<div class="api_metadata"> 1652<span>Added in: v12.0.0, v10.20.0</span> 1653</div> 1654<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1'. Use for compatibility with 1655old TLS clients or servers.</p> 1656<h4><code>--tls-min-v1.1</code><span><a class="mark" href="#--tls-min-v11" id="--tls-min-v11">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_1"></a></h4> 1657<div class="api_metadata"> 1658<span>Added in: v12.0.0, v10.20.0</span> 1659</div> 1660<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.1'. Use for compatibility 1661with old TLS clients or servers.</p> 1662<h4><code>--tls-min-v1.2</code><span><a class="mark" href="#--tls-min-v12" id="--tls-min-v12">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_2"></a></h4> 1663<div class="api_metadata"> 1664<span>Added in: v12.2.0, v10.20.0</span> 1665</div> 1666<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.2'. This is the default for 166712.x and later, but the option is supported for compatibility with older Node.js 1668versions.</p> 1669<h4><code>--tls-min-v1.3</code><span><a class="mark" href="#--tls-min-v13" id="--tls-min-v13">#</a></span><a aria-hidden="true" class="legacy" id="cli_tls_min_v1_3"></a></h4> 1670<div class="api_metadata"> 1671<span>Added in: v12.0.0</span> 1672</div> 1673<p>Set default <a href="tls.html#tlsdefault_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.3'. Use to disable support 1674for TLSv1.2, which is not as secure as TLSv1.3.</p> 1675<h4><code>--trace-atomics-wait</code><span><a class="mark" href="#--trace-atomics-wait" id="--trace-atomics-wait">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_atomics_wait"></a></h4> 1676<div class="api_metadata"> 1677<span>Added in: v14.3.0</span><span>Deprecated since: v18.8.0</span> 1678</div> 1679<p></p><div class="api_stability api_stability_0"><a href="documentation.html#stability-index">Stability: 0</a> - Deprecated</div><p></p> 1680<p>Print short summaries of calls to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait"><code>Atomics.wait()</code></a> to stderr. 1681The output could look like this:</p> 1682<pre><code class="language-text">(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 1, inf) started 1683(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 1, inf) did not wait because the values mismatched 1684(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 0, 10) started 1685(node:15701) [Thread 0] Atomics.wait(&lt;address> + 0, 0, 10) timed out 1686(node:15701) [Thread 0] Atomics.wait(&lt;address> + 4, 0, inf) started 1687(node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) started 1688(node:15701) [Thread 0] Atomics.wait(&lt;address> + 4, 0, inf) was woken up by another thread 1689(node:15701) [Thread 1] Atomics.wait(&lt;address> + 4, -1, inf) was woken up by another thread</code> <button class="copy-button">copy</button></pre> 1690<p>The fields here correspond to:</p> 1691<ul> 1692<li>The thread id as given by <a href="worker_threads.html#workerthreadid"><code>worker_threads.threadId</code></a></li> 1693<li>The base address of the <code>SharedArrayBuffer</code> in question, as well as the 1694byte offset corresponding to the index passed to <code>Atomics.wait()</code></li> 1695<li>The expected value that was passed to <code>Atomics.wait()</code></li> 1696<li>The timeout passed to <code>Atomics.wait</code></li> 1697</ul> 1698<h4><code>--trace-deprecation</code><span><a class="mark" href="#--trace-deprecation" id="--trace-deprecation">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_deprecation"></a></h4> 1699<div class="api_metadata"> 1700<span>Added in: v0.8.0</span> 1701</div> 1702<p>Print stack traces for deprecations.</p> 1703<h4><code>--trace-event-categories</code><span><a class="mark" href="#--trace-event-categories" id="--trace-event-categories">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_event_categories"></a></h4> 1704<div class="api_metadata"> 1705<span>Added in: v7.7.0</span> 1706</div> 1707<p>A comma separated list of categories that should be traced when trace event 1708tracing is enabled using <code>--trace-events-enabled</code>.</p> 1709<h4><code>--trace-event-file-pattern</code><span><a class="mark" href="#--trace-event-file-pattern" id="--trace-event-file-pattern">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_event_file_pattern"></a></h4> 1710<div class="api_metadata"> 1711<span>Added in: v9.8.0</span> 1712</div> 1713<p>Template string specifying the filepath for the trace event data, it 1714supports <code>${rotation}</code> and <code>${pid}</code>.</p> 1715<h4><code>--trace-events-enabled</code><span><a class="mark" href="#--trace-events-enabled" id="--trace-events-enabled">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_events_enabled"></a></h4> 1716<div class="api_metadata"> 1717<span>Added in: v7.7.0</span> 1718</div> 1719<p>Enables the collection of trace event tracing information.</p> 1720<h4><code>--trace-exit</code><span><a class="mark" href="#--trace-exit" id="--trace-exit">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_exit"></a></h4> 1721<div class="api_metadata"> 1722<span>Added in: v13.5.0, v12.16.0</span> 1723</div> 1724<p>Prints a stack trace whenever an environment is exited proactively, 1725i.e. invoking <code>process.exit()</code>.</p> 1726<h4><code>--trace-sigint</code><span><a class="mark" href="#--trace-sigint" id="--trace-sigint">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_sigint"></a></h4> 1727<div class="api_metadata"> 1728<span>Added in: v13.9.0, v12.17.0</span> 1729</div> 1730<p>Prints a stack trace on SIGINT.</p> 1731<h4><code>--trace-sync-io</code><span><a class="mark" href="#--trace-sync-io" id="--trace-sync-io">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_sync_io"></a></h4> 1732<div class="api_metadata"> 1733<span>Added in: v2.1.0</span> 1734</div> 1735<p>Prints a stack trace whenever synchronous I/O is detected after the first turn 1736of the event loop.</p> 1737<h4><code>--trace-tls</code><span><a class="mark" href="#--trace-tls" id="--trace-tls">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_tls"></a></h4> 1738<div class="api_metadata"> 1739<span>Added in: v12.2.0</span> 1740</div> 1741<p>Prints TLS packet trace information to <code>stderr</code>. This can be used to debug TLS 1742connection problems.</p> 1743<h4><code>--trace-uncaught</code><span><a class="mark" href="#--trace-uncaught" id="--trace-uncaught">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_uncaught"></a></h4> 1744<div class="api_metadata"> 1745<span>Added in: v13.1.0</span> 1746</div> 1747<p>Print stack traces for uncaught exceptions; usually, the stack trace associated 1748with the creation of an <code>Error</code> is printed, whereas this makes Node.js also 1749print the stack trace associated with throwing the value (which does not need 1750to be an <code>Error</code> instance).</p> 1751<p>Enabling this option may affect garbage collection behavior negatively.</p> 1752<h4><code>--trace-warnings</code><span><a class="mark" href="#--trace-warnings" id="--trace-warnings">#</a></span><a aria-hidden="true" class="legacy" id="cli_trace_warnings"></a></h4> 1753<div class="api_metadata"> 1754<span>Added in: v6.0.0</span> 1755</div> 1756<p>Print stack traces for process warnings (including deprecations).</p> 1757<h4><code>--track-heap-objects</code><span><a class="mark" href="#--track-heap-objects" id="--track-heap-objects">#</a></span><a aria-hidden="true" class="legacy" id="cli_track_heap_objects"></a></h4> 1758<div class="api_metadata"> 1759<span>Added in: v2.4.0</span> 1760</div> 1761<p>Track heap object allocations for heap snapshots.</p> 1762<h4><code>--unhandled-rejections=mode</code><span><a class="mark" href="#--unhandled-rejectionsmode" id="--unhandled-rejectionsmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_unhandled_rejections_mode"></a></h4> 1763<div class="api_metadata"> 1764<details class="changelog"><summary>History</summary> 1765<table> 1766<tbody><tr><th>Version</th><th>Changes</th></tr> 1767<tr><td>v15.0.0</td> 1768<td><p>Changed default mode to <code>throw</code>. Previously, a warning was emitted.</p></td></tr> 1769<tr><td>v12.0.0, v10.17.0</td> 1770<td><p><span>Added in: v12.0.0, v10.17.0</span></p></td></tr> 1771</tbody></table> 1772</details> 1773</div> 1774<p>Using this flag allows to change what should happen when an unhandled rejection 1775occurs. One of the following modes can be chosen:</p> 1776<ul> 1777<li><code>throw</code>: Emit <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a>. If this hook is not set, raise the 1778unhandled rejection as an uncaught exception. This is the default.</li> 1779<li><code>strict</code>: Raise the unhandled rejection as an uncaught exception. If the 1780exception is handled, <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a> is emitted.</li> 1781<li><code>warn</code>: Always trigger a warning, no matter if the <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a> 1782hook is set or not but do not print the deprecation warning.</li> 1783<li><code>warn-with-error-code</code>: Emit <a href="process.html#event-unhandledrejection"><code>unhandledRejection</code></a>. If this hook is not 1784set, trigger a warning, and set the process exit code to 1.</li> 1785<li><code>none</code>: Silence all warnings.</li> 1786</ul> 1787<p>If a rejection happens during the command line entry point's ES module static 1788loading phase, it will always raise it as an uncaught exception.</p> 1789<h4><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code><span><a class="mark" href="#--use-bundled-ca---use-openssl-ca" id="--use-bundled-ca---use-openssl-ca">#</a></span><a aria-hidden="true" class="legacy" id="cli_use_bundled_ca_use_openssl_ca"></a></h4> 1790<div class="api_metadata"> 1791<span>Added in: v6.11.0</span> 1792</div> 1793<p>Use bundled Mozilla CA store as supplied by current Node.js version 1794or use OpenSSL's default CA store. The default store is selectable 1795at build-time.</p> 1796<p>The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store 1797that is fixed at release time. It is identical on all supported platforms.</p> 1798<p>Using OpenSSL store allows for external modifications of the store. For most 1799Linux and BSD distributions, this store is maintained by the distribution 1800maintainers and system administrators. OpenSSL CA store location is dependent on 1801configuration of the OpenSSL library but this can be altered at runtime using 1802environment variables.</p> 1803<p>See <code>SSL_CERT_DIR</code> and <code>SSL_CERT_FILE</code>.</p> 1804<h4><code>--use-largepages=mode</code><span><a class="mark" href="#--use-largepagesmode" id="--use-largepagesmode">#</a></span><a aria-hidden="true" class="legacy" id="cli_use_largepages_mode"></a></h4> 1805<div class="api_metadata"> 1806<span>Added in: v13.6.0, v12.17.0</span> 1807</div> 1808<p>Re-map the Node.js static code to large memory pages at startup. If supported on 1809the target system, this will cause the Node.js static code to be moved onto 2 1810MiB pages instead of 4 KiB pages.</p> 1811<p>The following values are valid for <code>mode</code>:</p> 1812<ul> 1813<li><code>off</code>: No mapping will be attempted. This is the default.</li> 1814<li><code>on</code>: If supported by the OS, mapping will be attempted. Failure to map will 1815be ignored and a message will be printed to standard error.</li> 1816<li><code>silent</code>: If supported by the OS, mapping will be attempted. Failure to map 1817will be ignored and will not be reported.</li> 1818</ul> 1819<h4><code>--v8-options</code><span><a class="mark" href="#--v8-options" id="--v8-options">#</a></span><a aria-hidden="true" class="legacy" id="cli_v8_options"></a></h4> 1820<div class="api_metadata"> 1821<span>Added in: v0.1.3</span> 1822</div> 1823<p>Print V8 command-line options.</p> 1824<h4><code>--v8-pool-size=num</code><span><a class="mark" href="#--v8-pool-sizenum" id="--v8-pool-sizenum">#</a></span><a aria-hidden="true" class="legacy" id="cli_v8_pool_size_num"></a></h4> 1825<div class="api_metadata"> 1826<span>Added in: v5.10.0</span> 1827</div> 1828<p>Set V8's thread pool size which will be used to allocate background jobs.</p> 1829<p>If set to <code>0</code> then Node.js will choose an appropriate size of the thread pool 1830based on an estimate of the amount of parallelism.</p> 1831<p>The amount of parallelism refers to the number of computations that can be 1832carried out simultaneously in a given machine. In general, it's the same as the 1833amount of CPUs, but it may diverge in environments such as VMs or containers.</p> 1834<h4><code>--watch</code><span><a class="mark" href="#--watch" id="--watch">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch"></a></h4> 1835<div class="api_metadata"> 1836<details class="changelog"><summary>History</summary> 1837<table> 1838<tbody><tr><th>Version</th><th>Changes</th></tr> 1839<tr><td>v18.13.0</td> 1840<td><p>Test runner now supports running in watch mode.</p></td></tr> 1841<tr><td>v18.11.0</td> 1842<td><p><span>Added in: v18.11.0</span></p></td></tr> 1843</tbody></table> 1844</details> 1845</div> 1846<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1847<p>Starts Node.js in watch mode. 1848When in watch mode, changes in the watched files cause the Node.js process to 1849restart. 1850By default, watch mode will watch the entry point 1851and any required or imported module. 1852Use <code>--watch-path</code> to specify what paths to watch.</p> 1853<p>This flag cannot be combined with 1854<code>--check</code>, <code>--eval</code>, <code>--interactive</code>, or the REPL.</p> 1855<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --watch index.js</span></code> <button class="copy-button">copy</button></pre> 1856<h4><code>--watch-path</code><span><a class="mark" href="#--watch-path" id="--watch-path">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch_path"></a></h4> 1857<div class="api_metadata"> 1858<span>Added in: v18.11.0</span> 1859</div> 1860<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 1861<p>Starts Node.js in watch mode and specifies what paths to watch. 1862When in watch mode, changes in the watched paths cause the Node.js process to 1863restart. 1864This will turn off watching of required or imported modules, even when used in 1865combination with <code>--watch</code>.</p> 1866<p>This flag cannot be combined with 1867<code>--check</code>, <code>--eval</code>, <code>--interactive</code>, <code>--test</code>, or the REPL.</p> 1868<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --watch-path=./src --watch-path=./tests index.js</span></code> <button class="copy-button">copy</button></pre> 1869<p>This option is only supported on macOS and Windows. 1870An <code>ERR_FEATURE_UNAVAILABLE_ON_PLATFORM</code> exception will be thrown 1871when the option is used on a platform that does not support it.</p> 1872<h4><code>--watch-preserve-output</code><span><a class="mark" href="#--watch-preserve-output" id="--watch-preserve-output">#</a></span><a aria-hidden="true" class="legacy" id="cli_watch_preserve_output"></a></h4> 1873<p>Disable the clearing of the console when watch mode restarts the process.</p> 1874<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --watch --watch-preserve-output test.js</span></code> <button class="copy-button">copy</button></pre> 1875<h4><code>--zero-fill-buffers</code><span><a class="mark" href="#--zero-fill-buffers" id="--zero-fill-buffers">#</a></span><a aria-hidden="true" class="legacy" id="cli_zero_fill_buffers"></a></h4> 1876<div class="api_metadata"> 1877<span>Added in: v6.0.0</span> 1878</div> 1879<p>Automatically zero-fills all newly allocated <a href="buffer.html#class-buffer"><code>Buffer</code></a> and <a href="buffer.html#class-slowbuffer"><code>SlowBuffer</code></a> 1880instances.</p> 1881<h4><code>-c</code>, <code>--check</code><span><a class="mark" href="#-c---check" id="-c---check">#</a></span><a aria-hidden="true" class="legacy" id="cli_c_check"></a></h4> 1882<div class="api_metadata"> 1883<details class="changelog"><summary>History</summary> 1884<table> 1885<tbody><tr><th>Version</th><th>Changes</th></tr> 1886<tr><td>v10.0.0</td> 1887<td><p>The <code>--require</code> option is now supported when checking a file.</p></td></tr> 1888<tr><td>v5.0.0, v4.2.0</td> 1889<td><p><span>Added in: v5.0.0, v4.2.0</span></p></td></tr> 1890</tbody></table> 1891</details> 1892</div> 1893<p>Syntax check the script without executing.</p> 1894<h4><code>-e</code>, <code>--eval "script"</code><span><a class="mark" href="#-e---eval-script" id="-e---eval-script">#</a></span><a aria-hidden="true" class="legacy" id="cli_e_eval_script"></a></h4> 1895<div class="api_metadata"> 1896<details class="changelog"><summary>History</summary> 1897<table> 1898<tbody><tr><th>Version</th><th>Changes</th></tr> 1899<tr><td>v5.11.0</td> 1900<td><p>Built-in libraries are now available as predefined variables.</p></td></tr> 1901<tr><td>v0.5.2</td> 1902<td><p><span>Added in: v0.5.2</span></p></td></tr> 1903</tbody></table> 1904</details> 1905</div> 1906<p>Evaluate the following argument as JavaScript. The modules which are 1907predefined in the REPL can also be used in <code>script</code>.</p> 1908<p>On Windows, using <code>cmd.exe</code> a single quote will not work correctly because it 1909only recognizes double <code>"</code> for quoting. In Powershell or Git bash, both <code>'</code> 1910and <code>"</code> are usable.</p> 1911<h4><code>-h</code>, <code>--help</code><span><a class="mark" href="#-h---help" id="-h---help">#</a></span><a aria-hidden="true" class="legacy" id="cli_h_help"></a></h4> 1912<div class="api_metadata"> 1913<span>Added in: v0.1.3</span> 1914</div> 1915<p>Print node command-line options. 1916The output of this option is less detailed than this document.</p> 1917<h4><code>-i</code>, <code>--interactive</code><span><a class="mark" href="#-i---interactive" id="-i---interactive">#</a></span><a aria-hidden="true" class="legacy" id="cli_i_interactive"></a></h4> 1918<div class="api_metadata"> 1919<span>Added in: v0.7.7</span> 1920</div> 1921<p>Opens the REPL even if stdin does not appear to be a terminal.</p> 1922<h4><code>-p</code>, <code>--print "script"</code><span><a class="mark" href="#-p---print-script" id="-p---print-script">#</a></span><a aria-hidden="true" class="legacy" id="cli_p_print_script"></a></h4> 1923<div class="api_metadata"> 1924<details class="changelog"><summary>History</summary> 1925<table> 1926<tbody><tr><th>Version</th><th>Changes</th></tr> 1927<tr><td>v5.11.0</td> 1928<td><p>Built-in libraries are now available as predefined variables.</p></td></tr> 1929<tr><td>v0.6.4</td> 1930<td><p><span>Added in: v0.6.4</span></p></td></tr> 1931</tbody></table> 1932</details> 1933</div> 1934<p>Identical to <code>-e</code> but prints the result.</p> 1935<h4><code>-r</code>, <code>--require module</code><span><a class="mark" href="#-r---require-module" id="-r---require-module">#</a></span><a aria-hidden="true" class="legacy" id="cli_r_require_module"></a></h4> 1936<div class="api_metadata"> 1937<span>Added in: v1.6.0</span> 1938</div> 1939<p>Preload the specified module at startup.</p> 1940<p>Follows <code>require()</code>'s module resolution 1941rules. <code>module</code> may be either a path to a file, or a node module name.</p> 1942<p>Only CommonJS modules are supported. 1943Use <a href="#--importmodule"><code>--import</code></a> to preload an <a href="esm.html#modules-ecmascript-modules">ECMAScript module</a>. 1944Modules preloaded with <code>--require</code> will run before modules preloaded with <code>--import</code>.</p> 1945<h4><code>-v</code>, <code>--version</code><span><a class="mark" href="#-v---version" id="-v---version">#</a></span><a aria-hidden="true" class="legacy" id="cli_v_version"></a></h4> 1946<div class="api_metadata"> 1947<span>Added in: v0.1.3</span> 1948</div> 1949<p>Print node's version.</p> 1950</section><section><h3>Environment variables<span><a class="mark" href="#environment-variables" id="environment-variables">#</a></span><a aria-hidden="true" class="legacy" id="cli_environment_variables"></a></h3> 1951<h4><code>FORCE_COLOR=[1, 2, 3]</code><span><a class="mark" href="#force_color1-2-3" id="force_color1-2-3">#</a></span><a aria-hidden="true" class="legacy" id="cli_force_color_1_2_3"></a></h4> 1952<p>The <code>FORCE_COLOR</code> environment variable is used to 1953enable ANSI colorized output. The value may be:</p> 1954<ul> 1955<li><code>1</code>, <code>true</code>, or the empty string <code>''</code> indicate 16-color support,</li> 1956<li><code>2</code> to indicate 256-color support, or</li> 1957<li><code>3</code> to indicate 16 million-color support.</li> 1958</ul> 1959<p>When <code>FORCE_COLOR</code> is used and set to a supported value, both the <code>NO_COLOR</code>, 1960and <code>NODE_DISABLE_COLORS</code> environment variables are ignored.</p> 1961<p>Any other value will result in colorized output being disabled.</p> 1962<h4><code>NODE_DEBUG=module[,…]</code><span><a class="mark" href="#node_debugmodule" id="node_debugmodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_debug_module"></a></h4> 1963<div class="api_metadata"> 1964<span>Added in: v0.1.32</span> 1965</div> 1966<p><code>','</code>-separated list of core modules that should print debug information.</p> 1967<h4><code>NODE_DEBUG_NATIVE=module[,…]</code><span><a class="mark" href="#node_debug_nativemodule" id="node_debug_nativemodule">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_debug_native_module"></a></h4> 1968<p><code>','</code>-separated list of core C++ modules that should print debug information.</p> 1969<h4><code>NODE_DISABLE_COLORS=1</code><span><a class="mark" href="#node_disable_colors1" id="node_disable_colors1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_disable_colors_1"></a></h4> 1970<div class="api_metadata"> 1971<span>Added in: v0.3.0</span> 1972</div> 1973<p>When set, colors will not be used in the REPL.</p> 1974<h4><code>NODE_EXTRA_CA_CERTS=file</code><span><a class="mark" href="#node_extra_ca_certsfile" id="node_extra_ca_certsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_extra_ca_certs_file"></a></h4> 1975<div class="api_metadata"> 1976<span>Added in: v7.3.0</span> 1977</div> 1978<p>When set, the well known "root" CAs (like VeriSign) will be extended with the 1979extra certificates in <code>file</code>. The file should consist of one or more trusted 1980certificates in PEM format. A message will be emitted (once) with 1981<a href="process.html#processemitwarningwarning-options"><code>process.emitWarning()</code></a> if the file is missing or 1982malformed, but any errors are otherwise ignored.</p> 1983<p>Neither the well known nor extra certificates are used when the <code>ca</code> 1984options property is explicitly specified for a TLS or HTTPS client or server.</p> 1985<p>This environment variable is ignored when <code>node</code> runs as setuid root or 1986has Linux file capabilities set.</p> 1987<p>The <code>NODE_EXTRA_CA_CERTS</code> environment variable is only read when the Node.js 1988process is first launched. Changing the value at runtime using 1989<code>process.env.NODE_EXTRA_CA_CERTS</code> has no effect on the current process.</p> 1990<h4><code>NODE_ICU_DATA=file</code><span><a class="mark" href="#node_icu_datafile" id="node_icu_datafile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_icu_data_file"></a></h4> 1991<div class="api_metadata"> 1992<span>Added in: v0.11.15</span> 1993</div> 1994<p>Data path for ICU (<code>Intl</code> object) data. Will extend linked-in data when compiled 1995with small-icu support.</p> 1996<h4><code>NODE_NO_WARNINGS=1</code><span><a class="mark" href="#node_no_warnings1" id="node_no_warnings1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_no_warnings_1"></a></h4> 1997<div class="api_metadata"> 1998<span>Added in: v6.11.0</span> 1999</div> 2000<p>When set to <code>1</code>, process warnings are silenced.</p> 2001<h4><code>NODE_OPTIONS=options...</code><span><a class="mark" href="#node_optionsoptions" id="node_optionsoptions">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_options_options"></a></h4> 2002<div class="api_metadata"> 2003<span>Added in: v8.0.0</span> 2004</div> 2005<p>A space-separated list of command-line options. <code>options...</code> are interpreted 2006before command-line options, so command-line options will override or 2007compound after anything in <code>options...</code>. Node.js will exit with an error if 2008an option that is not allowed in the environment is used, such as <code>-p</code> or a 2009script file.</p> 2010<p>If an option value contains a space, it can be escaped using double quotes:</p> 2011<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./my path/file.js"'</span></code> <button class="copy-button">copy</button></pre> 2012<p>A singleton flag passed as a command-line option will override the same flag 2013passed into <code>NODE_OPTIONS</code>:</p> 2014<pre><code class="language-bash"><span class="hljs-comment"># The inspector will be available on port 5555</span> 2015NODE_OPTIONS=<span class="hljs-string">'--inspect=localhost:4444'</span> node --inspect=localhost:5555</code> <button class="copy-button">copy</button></pre> 2016<p>A flag that can be passed multiple times will be treated as if its 2017<code>NODE_OPTIONS</code> instances were passed first, and then its command-line 2018instances afterwards:</p> 2019<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./a.js"'</span> node --require <span class="hljs-string">"./b.js"</span> 2020<span class="hljs-comment"># is equivalent to:</span> 2021node --require <span class="hljs-string">"./a.js"</span> --require <span class="hljs-string">"./b.js"</span></code> <button class="copy-button">copy</button></pre> 2022<p>Node.js options that are allowed are:</p> 2023<!-- node-options-node start --> 2024<ul> 2025<li><code>--conditions</code>, <code>-C</code></li> 2026<li><code>--diagnostic-dir</code></li> 2027<li><code>--disable-proto</code></li> 2028<li><code>--dns-result-order</code></li> 2029<li><code>--enable-fips</code></li> 2030<li><code>--enable-network-family-autoselection</code></li> 2031<li><code>--enable-source-maps</code></li> 2032<li><code>--experimental-abortcontroller</code></li> 2033<li><code>--experimental-default-type</code></li> 2034<li><code>--experimental-global-customevent</code></li> 2035<li><code>--experimental-global-webcrypto</code></li> 2036<li><code>--experimental-import-meta-resolve</code></li> 2037<li><code>--experimental-json-modules</code></li> 2038<li><code>--experimental-loader</code></li> 2039<li><code>--experimental-modules</code></li> 2040<li><code>--experimental-network-imports</code></li> 2041<li><code>--experimental-policy</code></li> 2042<li><code>--experimental-shadow-realm</code></li> 2043<li><code>--experimental-specifier-resolution</code></li> 2044<li><code>--experimental-top-level-await</code></li> 2045<li><code>--experimental-vm-modules</code></li> 2046<li><code>--experimental-wasi-unstable-preview1</code></li> 2047<li><code>--experimental-wasm-modules</code></li> 2048<li><code>--force-context-aware</code></li> 2049<li><code>--force-fips</code></li> 2050<li><code>--force-node-api-uncaught-exceptions-policy</code></li> 2051<li><code>--frozen-intrinsics</code></li> 2052<li><code>--heapsnapshot-near-heap-limit</code></li> 2053<li><code>--heapsnapshot-signal</code></li> 2054<li><code>--http-parser</code></li> 2055<li><code>--icu-data-dir</code></li> 2056<li><code>--import</code></li> 2057<li><code>--input-type</code></li> 2058<li><code>--insecure-http-parser</code></li> 2059<li><code>--inspect-brk</code></li> 2060<li><code>--inspect-port</code>, <code>--debug-port</code></li> 2061<li><code>--inspect-publish-uid</code></li> 2062<li><code>--inspect</code></li> 2063<li><code>--max-http-header-size</code></li> 2064<li><code>--napi-modules</code></li> 2065<li><code>--no-addons</code></li> 2066<li><code>--no-deprecation</code></li> 2067<li><code>--no-experimental-fetch</code></li> 2068<li><code>--no-experimental-repl-await</code></li> 2069<li><code>--no-extra-info-on-fatal-exception</code></li> 2070<li><code>--no-force-async-hooks-checks</code></li> 2071<li><code>--no-global-search-paths</code></li> 2072<li><code>--no-warnings</code></li> 2073<li><code>--node-memory-debug</code></li> 2074<li><code>--openssl-config</code></li> 2075<li><code>--openssl-legacy-provider</code></li> 2076<li><code>--openssl-shared-config</code></li> 2077<li><code>--pending-deprecation</code></li> 2078<li><code>--policy-integrity</code></li> 2079<li><code>--preserve-symlinks-main</code></li> 2080<li><code>--preserve-symlinks</code></li> 2081<li><code>--prof-process</code></li> 2082<li><code>--redirect-warnings</code></li> 2083<li><code>--report-compact</code></li> 2084<li><code>--report-dir</code>, <code>--report-directory</code></li> 2085<li><code>--report-filename</code></li> 2086<li><code>--report-on-fatalerror</code></li> 2087<li><code>--report-on-signal</code></li> 2088<li><code>--report-signal</code></li> 2089<li><code>--report-uncaught-exception</code></li> 2090<li><code>--require</code>, <code>-r</code></li> 2091<li><code>--secure-heap-min</code></li> 2092<li><code>--secure-heap</code></li> 2093<li><code>--snapshot-blob</code></li> 2094<li><code>--test-only</code></li> 2095<li><code>--test-reporter-destination</code></li> 2096<li><code>--test-reporter</code></li> 2097<li><code>--test-shard</code></li> 2098<li><code>--throw-deprecation</code></li> 2099<li><code>--title</code></li> 2100<li><code>--tls-cipher-list</code></li> 2101<li><code>--tls-keylog</code></li> 2102<li><code>--tls-max-v1.2</code></li> 2103<li><code>--tls-max-v1.3</code></li> 2104<li><code>--tls-min-v1.0</code></li> 2105<li><code>--tls-min-v1.1</code></li> 2106<li><code>--tls-min-v1.2</code></li> 2107<li><code>--tls-min-v1.3</code></li> 2108<li><code>--trace-atomics-wait</code></li> 2109<li><code>--trace-deprecation</code></li> 2110<li><code>--trace-event-categories</code></li> 2111<li><code>--trace-event-file-pattern</code></li> 2112<li><code>--trace-events-enabled</code></li> 2113<li><code>--trace-exit</code></li> 2114<li><code>--trace-sigint</code></li> 2115<li><code>--trace-sync-io</code></li> 2116<li><code>--trace-tls</code></li> 2117<li><code>--trace-uncaught</code></li> 2118<li><code>--trace-warnings</code></li> 2119<li><code>--track-heap-objects</code></li> 2120<li><code>--unhandled-rejections</code></li> 2121<li><code>--use-bundled-ca</code></li> 2122<li><code>--use-largepages</code></li> 2123<li><code>--use-openssl-ca</code></li> 2124<li><code>--v8-pool-size</code></li> 2125<li><code>--watch-path</code></li> 2126<li><code>--watch-preserve-output</code></li> 2127<li><code>--watch</code></li> 2128<li><code>--zero-fill-buffers</code></li> 2129</ul> 2130<!-- node-options-node end --> 2131<p>V8 options that are allowed are:</p> 2132<!-- node-options-v8 start --> 2133<ul> 2134<li><code>--abort-on-uncaught-exception</code></li> 2135<li><code>--disallow-code-generation-from-strings</code></li> 2136<li><code>--enable-etw-stack-walking</code></li> 2137<li><code>--huge-max-old-generation-size</code></li> 2138<li><code>--interpreted-frames-native-stack</code></li> 2139<li><code>--jitless</code></li> 2140<li><code>--max-old-space-size</code></li> 2141<li><code>--max-semi-space-size</code></li> 2142<li><code>--perf-basic-prof-only-functions</code></li> 2143<li><code>--perf-basic-prof</code></li> 2144<li><code>--perf-prof-unwinding-info</code></li> 2145<li><code>--perf-prof</code></li> 2146<li><code>--stack-trace-limit</code></li> 2147</ul> 2148<!-- node-options-v8 end --> 2149<p><code>--perf-basic-prof-only-functions</code>, <code>--perf-basic-prof</code>, 2150<code>--perf-prof-unwinding-info</code>, and <code>--perf-prof</code> are only available on Linux.</p> 2151<p><code>--enable-etw-stack-walking</code> is only available on Windows.</p> 2152<h4><code>NODE_PATH=path[:…]</code><span><a class="mark" href="#node_pathpath" id="node_pathpath">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_path_path"></a></h4> 2153<div class="api_metadata"> 2154<span>Added in: v0.1.32</span> 2155</div> 2156<p><code>':'</code>-separated list of directories prefixed to the module search path.</p> 2157<p>On Windows, this is a <code>';'</code>-separated list instead.</p> 2158<h4><code>NODE_PENDING_DEPRECATION=1</code><span><a class="mark" href="#node_pending_deprecation1" id="node_pending_deprecation1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_pending_deprecation_1"></a></h4> 2159<div class="api_metadata"> 2160<span>Added in: v8.0.0</span> 2161</div> 2162<p>When set to <code>1</code>, emit pending deprecation warnings.</p> 2163<p>Pending deprecations are generally identical to a runtime deprecation with the 2164notable exception that they are turned <em>off</em> by default and will not be emitted 2165unless either the <code>--pending-deprecation</code> command-line flag, or the 2166<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations 2167are used to provide a kind of selective "early warning" mechanism that 2168developers may leverage to detect deprecated API usage.</p> 2169<h4><code>NODE_PENDING_PIPE_INSTANCES=instances</code><span><a class="mark" href="#node_pending_pipe_instancesinstances" id="node_pending_pipe_instancesinstances">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_pending_pipe_instances_instances"></a></h4> 2170<p>Set the number of pending pipe instance handles when the pipe server is waiting 2171for connections. This setting applies to Windows only.</p> 2172<h4><code>NODE_PRESERVE_SYMLINKS=1</code><span><a class="mark" href="#node_preserve_symlinks1" id="node_preserve_symlinks1">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_preserve_symlinks_1"></a></h4> 2173<div class="api_metadata"> 2174<span>Added in: v7.1.0</span> 2175</div> 2176<p>When set to <code>1</code>, instructs the module loader to preserve symbolic links when 2177resolving and caching modules.</p> 2178<h4><code>NODE_REDIRECT_WARNINGS=file</code><span><a class="mark" href="#node_redirect_warningsfile" id="node_redirect_warningsfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_redirect_warnings_file"></a></h4> 2179<div class="api_metadata"> 2180<span>Added in: v8.0.0</span> 2181</div> 2182<p>When set, process warnings will be emitted to the given file instead of 2183printing to stderr. The file will be created if it does not exist, and will be 2184appended to if it does. If an error occurs while attempting to write the 2185warning to the file, the warning will be written to stderr instead. This is 2186equivalent to using the <code>--redirect-warnings=file</code> command-line flag.</p> 2187<h4><code>NODE_REPL_HISTORY=file</code><span><a class="mark" href="#node_repl_historyfile" id="node_repl_historyfile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_repl_history_file"></a></h4> 2188<div class="api_metadata"> 2189<span>Added in: v3.0.0</span> 2190</div> 2191<p>Path to the file used to store the persistent REPL history. The default path is 2192<code>~/.node_repl_history</code>, which is overridden by this variable. Setting the value 2193to an empty string (<code>''</code> or <code>' '</code>) disables persistent REPL history.</p> 2194<h4><code>NODE_REPL_EXTERNAL_MODULE=file</code><span><a class="mark" href="#node_repl_external_modulefile" id="node_repl_external_modulefile">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_repl_external_module_file"></a></h4> 2195<div class="api_metadata"> 2196<span>Added in: v13.0.0, v12.16.0</span> 2197</div> 2198<p>Path to a Node.js module which will be loaded in place of the built-in REPL. 2199Overriding this value to an empty string (<code>''</code>) will use the built-in REPL.</p> 2200<h4><code>NODE_SKIP_PLATFORM_CHECK=value</code><span><a class="mark" href="#node_skip_platform_checkvalue" id="node_skip_platform_checkvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_skip_platform_check_value"></a></h4> 2201<div class="api_metadata"> 2202<span>Added in: v14.5.0</span> 2203</div> 2204<p>If <code>value</code> equals <code>'1'</code>, the check for a supported platform is skipped during 2205Node.js startup. Node.js might not execute correctly. Any issues encountered 2206on unsupported platforms will not be fixed.</p> 2207<h4><code>NODE_TEST_CONTEXT=value</code><span><a class="mark" href="#node_test_contextvalue" id="node_test_contextvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_test_context_value"></a></h4> 2208<p>If <code>value</code> equals <code>'child'</code>, test reporter options will be overridden and test 2209output will be sent to stdout in the TAP format. If any other value is provided, 2210Node.js makes no guarantees about the reporter format used or its stability.</p> 2211<h4><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code><span><a class="mark" href="#node_tls_reject_unauthorizedvalue" id="node_tls_reject_unauthorizedvalue">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_tls_reject_unauthorized_value"></a></h4> 2212<p>If <code>value</code> equals <code>'0'</code>, certificate validation is disabled for TLS connections. 2213This makes TLS, and HTTPS by extension, insecure. The use of this environment 2214variable is strongly discouraged.</p> 2215<h4><code>NODE_V8_COVERAGE=dir</code><span><a class="mark" href="#node_v8_coveragedir" id="node_v8_coveragedir">#</a></span><a aria-hidden="true" class="legacy" id="cli_node_v8_coverage_dir"></a></h4> 2216<p>When set, Node.js will begin outputting <a href="https://v8project.blogspot.com/2017/12/javascript-code-coverage.html">V8 JavaScript code coverage</a> and 2217<a href="https://sourcemaps.info/spec.html">Source Map</a> data to the directory provided as an argument (coverage 2218information is written as JSON to files with a <code>coverage</code> prefix).</p> 2219<p><code>NODE_V8_COVERAGE</code> will automatically propagate to subprocesses, making it 2220easier to instrument applications that call the <code>child_process.spawn()</code> family 2221of functions. <code>NODE_V8_COVERAGE</code> can be set to an empty string, to prevent 2222propagation.</p> 2223<h5>Coverage output<span><a class="mark" href="#coverage-output" id="coverage-output">#</a></span><a aria-hidden="true" class="legacy" id="cli_coverage_output"></a></h5> 2224<p>Coverage is output as an array of <a href="https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage">ScriptCoverage</a> objects on the top-level 2225key <code>result</code>:</p> 2226<pre><code class="language-json"><span class="hljs-punctuation">{</span> 2227 <span class="hljs-attr">"result"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span> 2228 <span class="hljs-punctuation">{</span> 2229 <span class="hljs-attr">"scriptId"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"67"</span><span class="hljs-punctuation">,</span> 2230 <span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"internal/tty.js"</span><span class="hljs-punctuation">,</span> 2231 <span class="hljs-attr">"functions"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-punctuation">]</span> 2232 <span class="hljs-punctuation">}</span> 2233 <span class="hljs-punctuation">]</span> 2234<span class="hljs-punctuation">}</span></code> <button class="copy-button">copy</button></pre> 2235<h5>Source map cache<span><a class="mark" href="#source-map-cache" id="source-map-cache">#</a></span><a aria-hidden="true" class="legacy" id="cli_source_map_cache"></a></h5> 2236<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p> 2237<p>If found, source map data is appended to the top-level key <code>source-map-cache</code> 2238on the JSON coverage object.</p> 2239<p><code>source-map-cache</code> is an object with keys representing the files source maps 2240were extracted from, and values which include the raw source-map URL 2241(in the key <code>url</code>), the parsed Source Map v3 information (in the key <code>data</code>), 2242and the line lengths of the source file (in the key <code>lineLengths</code>).</p> 2243<pre><code class="language-json"><span class="hljs-punctuation">{</span> 2244 <span class="hljs-attr">"result"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span> 2245 <span class="hljs-punctuation">{</span> 2246 <span class="hljs-attr">"scriptId"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"68"</span><span class="hljs-punctuation">,</span> 2247 <span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"file:///absolute/path/to/source.js"</span><span class="hljs-punctuation">,</span> 2248 <span class="hljs-attr">"functions"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><span class="hljs-punctuation">]</span> 2249 <span class="hljs-punctuation">}</span> 2250 <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span> 2251 <span class="hljs-attr">"source-map-cache"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span> 2252 <span class="hljs-attr">"file:///absolute/path/to/source.js"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span> 2253 <span class="hljs-attr">"url"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"./path-to-map.json"</span><span class="hljs-punctuation">,</span> 2254 <span class="hljs-attr">"data"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">{</span> 2255 <span class="hljs-attr">"version"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">3</span><span class="hljs-punctuation">,</span> 2256 <span class="hljs-attr">"sources"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span> 2257 <span class="hljs-string">"file:///absolute/path/to/original.js"</span> 2258 <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span> 2259 <span class="hljs-attr">"names"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span> 2260 <span class="hljs-string">"Foo"</span><span class="hljs-punctuation">,</span> 2261 <span class="hljs-string">"console"</span><span class="hljs-punctuation">,</span> 2262 <span class="hljs-string">"info"</span> 2263 <span class="hljs-punctuation">]</span><span class="hljs-punctuation">,</span> 2264 <span class="hljs-attr">"mappings"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"MAAMA,IACJC,YAAaC"</span><span class="hljs-punctuation">,</span> 2265 <span class="hljs-attr">"sourceRoot"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"./"</span> 2266 <span class="hljs-punctuation">}</span><span class="hljs-punctuation">,</span> 2267 <span class="hljs-attr">"lineLengths"</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span> 2268 <span class="hljs-number">13</span><span class="hljs-punctuation">,</span> 2269 <span class="hljs-number">62</span><span class="hljs-punctuation">,</span> 2270 <span class="hljs-number">38</span><span class="hljs-punctuation">,</span> 2271 <span class="hljs-number">27</span> 2272 <span class="hljs-punctuation">]</span> 2273 <span class="hljs-punctuation">}</span> 2274 <span class="hljs-punctuation">}</span> 2275<span class="hljs-punctuation">}</span></code> <button class="copy-button">copy</button></pre> 2276<h4><code>NO_COLOR=<any></code><span><a class="mark" href="#no_colorany" id="no_colorany">#</a></span><a aria-hidden="true" class="legacy" id="cli_no_color_any"></a></h4> 2277<p><a href="https://no-color.org"><code>NO_COLOR</code></a> is an alias for <code>NODE_DISABLE_COLORS</code>. The value of the 2278environment variable is arbitrary.</p> 2279<h4><code>OPENSSL_CONF=file</code><span><a class="mark" href="#openssl_conffile" id="openssl_conffile">#</a></span><a aria-hidden="true" class="legacy" id="cli_openssl_conf_file"></a></h4> 2280<div class="api_metadata"> 2281<span>Added in: v6.11.0</span> 2282</div> 2283<p>Load an OpenSSL configuration file on startup. Among other uses, this can be 2284used to enable FIPS-compliant crypto if Node.js is built with 2285<code>./configure --openssl-fips</code>.</p> 2286<p>If the <a href="#--openssl-configfile"><code>--openssl-config</code></a> command-line option is used, the environment 2287variable is ignored.</p> 2288<h4><code>SSL_CERT_DIR=dir</code><span><a class="mark" href="#ssl_cert_dirdir" id="ssl_cert_dirdir">#</a></span><a aria-hidden="true" class="legacy" id="cli_ssl_cert_dir_dir"></a></h4> 2289<div class="api_metadata"> 2290<span>Added in: v7.7.0</span> 2291</div> 2292<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's directory 2293containing trusted certificates.</p> 2294<p>Be aware that unless the child environment is explicitly set, this environment 2295variable will be inherited by any child processes, and if they use OpenSSL, it 2296may cause them to trust the same CAs as node.</p> 2297<h4><code>SSL_CERT_FILE=file</code><span><a class="mark" href="#ssl_cert_filefile" id="ssl_cert_filefile">#</a></span><a aria-hidden="true" class="legacy" id="cli_ssl_cert_file_file"></a></h4> 2298<div class="api_metadata"> 2299<span>Added in: v7.7.0</span> 2300</div> 2301<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's file 2302containing trusted certificates.</p> 2303<p>Be aware that unless the child environment is explicitly set, this environment 2304variable will be inherited by any child processes, and if they use OpenSSL, it 2305may cause them to trust the same CAs as node.</p> 2306<h4><code>TZ</code><span><a class="mark" href="#tz" id="tz">#</a></span><a aria-hidden="true" class="legacy" id="cli_tz"></a></h4> 2307<div class="api_metadata"> 2308<details class="changelog"><summary>History</summary> 2309<table> 2310<tbody><tr><th>Version</th><th>Changes</th></tr> 2311<tr><td>v16.2.0</td> 2312<td><p>Changing the TZ variable using process.env.TZ = changes the timezone on Windows as well.</p></td></tr> 2313<tr><td>v13.0.0</td> 2314<td><p>Changing the TZ variable using process.env.TZ = changes the timezone on POSIX systems.</p></td></tr> 2315<tr><td>v0.0.1</td> 2316<td><p><span>Added in: v0.0.1</span></p></td></tr> 2317</tbody></table> 2318</details> 2319</div> 2320<p>The <code>TZ</code> environment variable is used to specify the timezone configuration.</p> 2321<p>While Node.js does not support all of the various <a href="https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html">ways that <code>TZ</code> is handled in 2322other environments</a>, it does support basic <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">timezone IDs</a> (such as 2323<code>'Etc/UTC'</code>, <code>'Europe/Paris'</code>, or <code>'America/New_York'</code>). 2324It may support a few other abbreviations or aliases, but these are strongly 2325discouraged and not guaranteed.</p> 2326<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">TZ=Europe/Dublin node -pe <span class="hljs-string">"new Date().toString()"</span></span> 2327Wed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)</code> <button class="copy-button">copy</button></pre> 2328<h4><code>UV_THREADPOOL_SIZE=size</code><span><a class="mark" href="#uv_threadpool_sizesize" id="uv_threadpool_sizesize">#</a></span><a aria-hidden="true" class="legacy" id="cli_uv_threadpool_size_size"></a></h4> 2329<p>Set the number of threads used in libuv's threadpool to <code>size</code> threads.</p> 2330<p>Asynchronous system APIs are used by Node.js whenever possible, but where they 2331do not exist, libuv's threadpool is used to create asynchronous node APIs based 2332on synchronous system APIs. Node.js APIs that use the threadpool are:</p> 2333<ul> 2334<li>all <code>fs</code> APIs, other than the file watcher APIs and those that are explicitly 2335synchronous</li> 2336<li>asynchronous crypto APIs such as <code>crypto.pbkdf2()</code>, <code>crypto.scrypt()</code>, 2337<code>crypto.randomBytes()</code>, <code>crypto.randomFill()</code>, <code>crypto.generateKeyPair()</code></li> 2338<li><code>dns.lookup()</code></li> 2339<li>all <code>zlib</code> APIs, other than those that are explicitly synchronous</li> 2340</ul> 2341<p>Because libuv's threadpool has a fixed size, it means that if for whatever 2342reason any of these APIs takes a long time, other (seemingly unrelated) APIs 2343that run in libuv's threadpool will experience degraded performance. In order to 2344mitigate this issue, one potential solution is to increase the size of libuv's 2345threadpool by setting the <code>'UV_THREADPOOL_SIZE'</code> environment variable to a value 2346greater than <code>4</code> (its current default value). For more information, see the 2347<a href="https://docs.libuv.org/en/latest/threadpool.html">libuv threadpool documentation</a>.</p> 2348</section><section><h3>Useful V8 options<span><a class="mark" href="#useful-v8-options" id="useful-v8-options">#</a></span><a aria-hidden="true" class="legacy" id="cli_useful_v8_options"></a></h3> 2349<p>V8 has its own set of CLI options. Any V8 CLI option that is provided to <code>node</code> 2350will be passed on to V8 to handle. V8's options have <em>no stability guarantee</em>. 2351The V8 team themselves don't consider them to be part of their formal API, 2352and reserve the right to change them at any time. Likewise, they are not 2353covered by the Node.js stability guarantees. Many of the V8 2354options are of interest only to V8 developers. Despite this, there is a small 2355set of V8 options that are widely applicable to Node.js, and they are 2356documented here:</p> 2357<h4><code>--max-old-space-size=SIZE</code> (in megabytes)<span><a class="mark" href="#--max-old-space-sizesize-in-megabytes" id="--max-old-space-sizesize-in-megabytes">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_old_space_size_size_in_megabytes"></a></h4> 2358<p>Sets the max memory size of V8's old memory section. As memory 2359consumption approaches the limit, V8 will spend more time on 2360garbage collection in an effort to free unused memory.</p> 2361<p>On a machine with 2 GiB of memory, consider setting this to 23621536 (1.5 GiB) to leave some memory for other uses and avoid swapping.</p> 2363<pre><code class="language-console"><span class="hljs-meta prompt_">$ </span><span class="language-bash">node --max-old-space-size=1536 index.js</span></code> <button class="copy-button">copy</button></pre> 2364<h4><code>--max-semi-space-size=SIZE</code> (in megabytes)<span><a class="mark" href="#--max-semi-space-sizesize-in-megabytes" id="--max-semi-space-sizesize-in-megabytes">#</a></span><a aria-hidden="true" class="legacy" id="cli_max_semi_space_size_size_in_megabytes"></a></h4> 2365<p>Sets the maximum <a href="https://www.memorymanagement.org/glossary/s.html#semi.space">semi-space</a> size for V8's <a href="https://v8.dev/blog/orinoco-parallel-scavenger">scavenge garbage collector</a> in 2366MiB (megabytes). 2367Increasing the max size of a semi-space may improve throughput for Node.js at 2368the cost of more memory consumption.</p> 2369<p>Since the young generation size of the V8 heap is three times (see 2370<a href="https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328"><code>YoungGenerationSizeFromSemiSpaceSize</code></a> in V8) the size of the semi-space, 2371an increase of 1 MiB to semi-space applies to each of the three individual 2372semi-spaces and causes the heap size to increase by 3 MiB. The throughput 2373improvement depends on your workload (see <a href="https://github.com/nodejs/node/issues/42511">#42511</a>).</p> 2374<p>The default value is 16 MiB for 64-bit systems and 8 MiB for 32-bit systems. To 2375get the best configuration for your application, you should try different 2376max-semi-space-size values when running benchmarks for your application.</p> 2377<p>For example, benchmark on a 64-bit systems:</p> 2378<pre><code class="language-bash"><span class="hljs-keyword">for</span> MiB <span class="hljs-keyword">in</span> 16 32 64 128; <span class="hljs-keyword">do</span> 2379 node --max-semi-space-size=<span class="hljs-variable">$MiB</span> index.js 2380<span class="hljs-keyword">done</span></code> <button class="copy-button">copy</button></pre></section> 2381 <!-- API END --> 2382 </div> 2383 </div> 2384 </div> 2385</body> 2386</html> 2387