1468 lines
86 KiB
HTML
1468 lines
86 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width">
|
|
<meta name="nodejs.org:node-version" content="v12.22.12">
|
|
<title>Command line options | Node.js v12.22.12 Documentation</title>
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
|
|
<link rel="stylesheet" href="assets/style.css">
|
|
<link rel="stylesheet" href="assets/hljs.css">
|
|
<link rel="canonical" href="https://nodejs.org/api/cli.html">
|
|
</head>
|
|
<body class="alt apidoc" id="api-section-cli">
|
|
<div id="content" class="clearfix">
|
|
<div id="column2" class="interior">
|
|
<div id="intro" class="interior">
|
|
<a href="/" title="Go back to the home page">
|
|
Node.js
|
|
</a>
|
|
</div>
|
|
<ul>
|
|
<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
|
|
<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
|
|
</ul>
|
|
<hr class="line">
|
|
<ul>
|
|
<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
|
|
<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
|
|
<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
|
|
<li><a href="addons.html" class="nav-addons">C++ Addons</a></li>
|
|
<li><a href="n-api.html" class="nav-n-api">C/C++ Addons with N-API</a></li>
|
|
<li><a href="embedding.html" class="nav-embedding">C++ Embedder API</a></li>
|
|
<li><a href="child_process.html" class="nav-child_process">Child Processes</a></li>
|
|
<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
|
|
<li><a href="cli.html" class="nav-cli active">Command line options</a></li>
|
|
<li><a href="console.html" class="nav-console">Console</a></li>
|
|
<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
|
|
<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
|
|
<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
|
|
<li><a href="dns.html" class="nav-dns">DNS</a></li>
|
|
<li><a href="domain.html" class="nav-domain">Domain</a></li>
|
|
<li><a href="errors.html" class="nav-errors">Errors</a></li>
|
|
<li><a href="events.html" class="nav-events">Events</a></li>
|
|
<li><a href="fs.html" class="nav-fs">File system</a></li>
|
|
<li><a href="globals.html" class="nav-globals">Globals</a></li>
|
|
<li><a href="http.html" class="nav-http">HTTP</a></li>
|
|
<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
|
|
<li><a href="https.html" class="nav-https">HTTPS</a></li>
|
|
<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
|
|
<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
|
|
<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
|
|
<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
|
|
<li><a href="module.html" class="nav-module">Modules: <code>module</code> API</a></li>
|
|
<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
|
|
<li><a href="net.html" class="nav-net">Net</a></li>
|
|
<li><a href="os.html" class="nav-os">OS</a></li>
|
|
<li><a href="path.html" class="nav-path">Path</a></li>
|
|
<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
|
|
<li><a href="policy.html" class="nav-policy">Policies</a></li>
|
|
<li><a href="process.html" class="nav-process">Process</a></li>
|
|
<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
|
|
<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
|
|
<li><a href="readline.html" class="nav-readline">Readline</a></li>
|
|
<li><a href="repl.html" class="nav-repl">REPL</a></li>
|
|
<li><a href="report.html" class="nav-report">Report</a></li>
|
|
<li><a href="stream.html" class="nav-stream">Stream</a></li>
|
|
<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
|
|
<li><a href="timers.html" class="nav-timers">Timers</a></li>
|
|
<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
|
|
<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
|
|
<li><a href="tty.html" class="nav-tty">TTY</a></li>
|
|
<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
|
|
<li><a href="url.html" class="nav-url">URL</a></li>
|
|
<li><a href="util.html" class="nav-util">Utilities</a></li>
|
|
<li><a href="v8.html" class="nav-v8">V8</a></li>
|
|
<li><a href="vm.html" class="nav-vm">VM</a></li>
|
|
<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
|
|
<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
|
|
<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
|
|
</ul>
|
|
<hr class="line">
|
|
<ul>
|
|
<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="column1" data-id="cli" class="interior">
|
|
<header>
|
|
<h1>Node.js v12.22.12 Documentation</h1>
|
|
<div id="gtoc">
|
|
<ul>
|
|
<li>
|
|
<a href="index.html">Index</a>
|
|
</li>
|
|
<li>
|
|
<a href="all.html">View on single page</a>
|
|
</li>
|
|
<li>
|
|
<a href="cli.json">View as JSON</a>
|
|
</li>
|
|
|
|
<li class="version-picker">
|
|
<a href="#">View another version <span>▼</span></a>
|
|
<ol class="version-picker"><li><a href="https://nodejs.org/docs/latest-v17.x/api/cli.html">17.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v16.x/api/cli.html">16.x <b>LTS</b></a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v15.x/api/cli.html">15.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v14.x/api/cli.html">14.x <b>LTS</b></a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v13.x/api/cli.html">13.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v12.x/api/cli.html">12.x <b>LTS</b></a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v11.x/api/cli.html">11.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v10.x/api/cli.html">10.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v9.x/api/cli.html">9.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v8.x/api/cli.html">8.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v7.x/api/cli.html">7.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v6.x/api/cli.html">6.x</a></li>
|
|
<li><a href="https://nodejs.org/docs/latest-v5.x/api/cli.html">5.x</a></li></ol>
|
|
</li>
|
|
|
|
<li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/master/doc/api/cli.md"><span class="github_icon"><svg height="16" width="16" viewBox="0 0 16.1 16.1" fill="currentColor"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4 0 .5-.2.5-.4v-1.5c-2 .4-2.5-.5-2.7-1 0-.1-.5-.9-.8-1-.3-.2-.7-.6 0-.6.6 0 1 .6 1.2.8.7 1.2 1.9 1 2.4.7 0-.5.2-.9.5-1-1.8-.3-3.7-1-3.7-4 0-.9.3-1.6.8-2.2 0-.2-.3-1 .1-2 0 0 .7-.3 2.2.7a7.4 7.4 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.5 1.1.2 2 .1 2.1.5.6.8 1.3.8 2.2 0 3-1.9 3.7-3.6 4 .3.2.5.7.5 1.4v2.2c0 .2.1.5.5.4A8 8 0 0 0 16 8a8 8 0 0 0-8-8z"/></svg></span>Edit on GitHub</a></li>
|
|
</ul>
|
|
</div>
|
|
<hr>
|
|
</header>
|
|
|
|
<div id="toc">
|
|
<h2>Table of Contents</h2>
|
|
<ul>
|
|
<li><a href="#cli_command_line_options">Command line options</a>
|
|
<ul>
|
|
<li><a href="#cli_synopsis">Synopsis</a></li>
|
|
<li><a href="#cli_options">Options</a>
|
|
<ul>
|
|
<li><a href="#cli"><code>-</code></a></li>
|
|
<li><a href="#cli_1"><code>--</code></a></li>
|
|
<li><a href="#cli_abort_on_uncaught_exception"><code>--abort-on-uncaught-exception</code></a></li>
|
|
<li><a href="#cli_completion_bash"><code>--completion-bash</code></a></li>
|
|
<li><span class="stability_1"><a href="#cli_conditions_condition"><code>--conditions=condition</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_cpu_prof"><code>--cpu-prof</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_cpu_prof_dir"><code>--cpu-prof-dir</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_cpu_prof_interval"><code>--cpu-prof-interval</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_cpu_prof_name"><code>--cpu-prof-name</code></a></span></li>
|
|
<li><a href="#cli_diagnostic_dir_directory"><code>--diagnostic-dir=directory</code></a></li>
|
|
<li><a href="#cli_disable_proto_mode"><code>--disable-proto=mode</code></a></li>
|
|
<li><a href="#cli_disallow_code_generation_from_strings"><code>--disallow-code-generation-from-strings</code></a></li>
|
|
<li><a href="#cli_enable_fips"><code>--enable-fips</code></a></li>
|
|
<li><span class="stability_1"><a href="#cli_enable_source_maps"><code>--enable-source-maps</code></a></span></li>
|
|
<li><a href="#cli_experimental_import_meta_resolve"><code>--experimental-import-meta-resolve</code></a></li>
|
|
<li><a href="#cli_experimental_json_modules"><code>--experimental-json-modules</code></a></li>
|
|
<li><a href="#cli_experimental_loader_module"><code>--experimental-loader=module</code></a></li>
|
|
<li><a href="#cli_experimental_modules"><code>--experimental-modules</code></a></li>
|
|
<li><a href="#cli_experimental_policy"><code>--experimental-policy</code></a></li>
|
|
<li><a href="#cli_experimental_repl_await"><code>--experimental-repl-await</code></a></li>
|
|
<li><a href="#cli_experimental_specifier_resolution_mode"><code>--experimental-specifier-resolution=mode</code></a></li>
|
|
<li><a href="#cli_experimental_vm_modules"><code>--experimental-vm-modules</code></a></li>
|
|
<li><a href="#cli_experimental_wasi_unstable_preview1"><code>--experimental-wasi-unstable-preview1</code></a></li>
|
|
<li><a href="#cli_experimental_wasm_modules"><code>--experimental-wasm-modules</code></a></li>
|
|
<li><a href="#cli_force_context_aware"><code>--force-context-aware</code></a></li>
|
|
<li><a href="#cli_force_fips"><code>--force-fips</code></a></li>
|
|
<li><span class="stability_1"><a href="#cli_frozen_intrinsics"><code>--frozen-intrinsics</code></a></span></li>
|
|
<li><a href="#cli_heapsnapshot_signal_signal"><code>--heapsnapshot-signal=signal</code></a></li>
|
|
<li><span class="stability_1"><a href="#cli_heap_prof"><code>--heap-prof</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_heap_prof_dir"><code>--heap-prof-dir</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_heap_prof_interval"><code>--heap-prof-interval</code></a></span></li>
|
|
<li><span class="stability_1"><a href="#cli_heap_prof_name"><code>--heap-prof-name</code></a></span></li>
|
|
<li><a href="#cli_http_parser_library"><code>--http-parser=library</code></a></li>
|
|
<li><a href="#cli_http_server_default_timeout_milliseconds"><code>--http-server-default-timeout=milliseconds</code></a></li>
|
|
<li><a href="#cli_icu_data_dir_file"><code>--icu-data-dir=file</code></a></li>
|
|
<li><a href="#cli_input_type_type"><code>--input-type=type</code></a></li>
|
|
<li><a href="#cli_inspect_brk_host_port"><code>--inspect-brk[=[host:]port]</code></a></li>
|
|
<li><a href="#cli_inspect_port_host_port"><code>--inspect-port=[host:]port</code></a></li>
|
|
<li><a href="#cli_inspect_host_port"><code>--inspect[=[host:]port]</code></a>
|
|
<ul>
|
|
<li><a href="#cli_warning_binding_inspector_to_a_public_ip_port_combination_is_insecure">Warning: binding inspector to a public IP:port combination is insecure</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#cli_inspect_publish_uid_stderr_http"><code>--inspect-publish-uid=stderr,http</code></a></li>
|
|
<li><a href="#cli_insecure_http_parser"><code>--insecure-http-parser</code></a></li>
|
|
<li><a href="#cli_jitless"><code>--jitless</code></a></li>
|
|
<li><a href="#cli_max_http_header_size_size"><code>--max-http-header-size=size</code></a></li>
|
|
<li><a href="#cli_napi_modules"><code>--napi-modules</code></a></li>
|
|
<li><a href="#cli_no_deprecation"><code>--no-deprecation</code></a></li>
|
|
<li><a href="#cli_no_force_async_hooks_checks"><code>--no-force-async-hooks-checks</code></a></li>
|
|
<li><a href="#cli_no_warnings"><code>--no-warnings</code></a></li>
|
|
<li><a href="#cli_openssl_config_file"><code>--openssl-config=file</code></a></li>
|
|
<li><a href="#cli_pending_deprecation"><code>--pending-deprecation</code></a></li>
|
|
<li><span class="stability_1"><a href="#cli_policy_integrity_sri"><code>--policy-integrity=sri</code></a></span></li>
|
|
<li><a href="#cli_preserve_symlinks"><code>--preserve-symlinks</code></a></li>
|
|
<li><a href="#cli_preserve_symlinks_main"><code>--preserve-symlinks-main</code></a></li>
|
|
<li><a href="#cli_prof"><code>--prof</code></a></li>
|
|
<li><a href="#cli_prof_process"><code>--prof-process</code></a></li>
|
|
<li><a href="#cli_redirect_warnings_file"><code>--redirect-warnings=file</code></a></li>
|
|
<li><a href="#cli_report_compact"><code>--report-compact</code></a></li>
|
|
<li><a href="#cli_report_dir_directory_report_directory_directory"><code>--report-dir=directory</code>, <code>report-directory=directory</code></a></li>
|
|
<li><a href="#cli_report_filename_filename"><code>--report-filename=filename</code></a></li>
|
|
<li><a href="#cli_report_on_fatalerror"><code>--report-on-fatalerror</code></a></li>
|
|
<li><a href="#cli_report_on_signal"><code>--report-on-signal</code></a></li>
|
|
<li><a href="#cli_report_signal_signal"><code>--report-signal=signal</code></a></li>
|
|
<li><a href="#cli_report_uncaught_exception"><code>--report-uncaught-exception</code></a></li>
|
|
<li><a href="#cli_throw_deprecation"><code>--throw-deprecation</code></a></li>
|
|
<li><a href="#cli_title_title"><code>--title=title</code></a></li>
|
|
<li><a href="#cli_tls_cipher_list_list"><code>--tls-cipher-list=list</code></a></li>
|
|
<li><a href="#cli_tls_keylog_file"><code>--tls-keylog=file</code></a></li>
|
|
<li><a href="#cli_tls_max_v1_2"><code>--tls-max-v1.2</code></a></li>
|
|
<li><a href="#cli_tls_max_v1_3"><code>--tls-max-v1.3</code></a></li>
|
|
<li><a href="#cli_tls_min_v1_0"><code>--tls-min-v1.0</code></a></li>
|
|
<li><a href="#cli_tls_min_v1_1"><code>--tls-min-v1.1</code></a></li>
|
|
<li><a href="#cli_tls_min_v1_2"><code>--tls-min-v1.2</code></a></li>
|
|
<li><a href="#cli_tls_min_v1_3"><code>--tls-min-v1.3</code></a></li>
|
|
<li><a href="#cli_trace_deprecation"><code>--trace-deprecation</code></a></li>
|
|
<li><a href="#cli_trace_event_categories"><code>--trace-event-categories</code></a></li>
|
|
<li><a href="#cli_trace_event_file_pattern"><code>--trace-event-file-pattern</code></a></li>
|
|
<li><a href="#cli_trace_events_enabled"><code>--trace-events-enabled</code></a></li>
|
|
<li><a href="#cli_trace_exit"><code>--trace-exit</code></a></li>
|
|
<li><a href="#cli_trace_sigint"><code>--trace-sigint</code></a></li>
|
|
<li><a href="#cli_trace_sync_io"><code>--trace-sync-io</code></a></li>
|
|
<li><a href="#cli_trace_tls"><code>--trace-tls</code></a></li>
|
|
<li><a href="#cli_trace_uncaught"><code>--trace-uncaught</code></a></li>
|
|
<li><a href="#cli_trace_warnings"><code>--trace-warnings</code></a></li>
|
|
<li><a href="#cli_track_heap_objects"><code>--track-heap-objects</code></a></li>
|
|
<li><a href="#cli_unhandled_rejections_mode"><code>--unhandled-rejections=mode</code></a></li>
|
|
<li><a href="#cli_use_bundled_ca_use_openssl_ca"><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code></a></li>
|
|
<li><a href="#cli_use_largepages_mode"><code>--use-largepages=mode</code></a></li>
|
|
<li><a href="#cli_v8_options"><code>--v8-options</code></a></li>
|
|
<li><a href="#cli_v8_pool_size_num"><code>--v8-pool-size=num</code></a></li>
|
|
<li><a href="#cli_zero_fill_buffers"><code>--zero-fill-buffers</code></a></li>
|
|
<li><a href="#cli_c_check"><code>-c</code>, <code>--check</code></a></li>
|
|
<li><a href="#cli_e_eval_script"><code>-e</code>, <code>--eval "script"</code></a></li>
|
|
<li><a href="#cli_h_help"><code>-h</code>, <code>--help</code></a></li>
|
|
<li><a href="#cli_i_interactive"><code>-i</code>, <code>--interactive</code></a></li>
|
|
<li><a href="#cli_p_print_script"><code>-p</code>, <code>--print "script"</code></a></li>
|
|
<li><a href="#cli_r_require_module"><code>-r</code>, <code>--require module</code></a></li>
|
|
<li><a href="#cli_v_version"><code>-v</code>, <code>--version</code></a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#cli_environment_variables">Environment variables</a>
|
|
<ul>
|
|
<li><a href="#cli_node_debug_module"><code>NODE_DEBUG=module[,…]</code></a></li>
|
|
<li><a href="#cli_node_debug_native_module"><code>NODE_DEBUG_NATIVE=module[,…]</code></a></li>
|
|
<li><a href="#cli_node_disable_colors_1"><code>NODE_DISABLE_COLORS=1</code></a></li>
|
|
<li><a href="#cli_node_extra_ca_certs_file"><code>NODE_EXTRA_CA_CERTS=file</code></a></li>
|
|
<li><a href="#cli_node_icu_data_file"><code>NODE_ICU_DATA=file</code></a></li>
|
|
<li><a href="#cli_node_no_warnings_1"><code>NODE_NO_WARNINGS=1</code></a></li>
|
|
<li><a href="#cli_node_options_options"><code>NODE_OPTIONS=options...</code></a></li>
|
|
<li><a href="#cli_node_path_path"><code>NODE_PATH=path[:…]</code></a></li>
|
|
<li><a href="#cli_node_pending_deprecation_1"><code>NODE_PENDING_DEPRECATION=1</code></a></li>
|
|
<li><a href="#cli_node_pending_pipe_instances_instances"><code>NODE_PENDING_PIPE_INSTANCES=instances</code></a></li>
|
|
<li><a href="#cli_node_preserve_symlinks_1"><code>NODE_PRESERVE_SYMLINKS=1</code></a></li>
|
|
<li><a href="#cli_node_redirect_warnings_file"><code>NODE_REDIRECT_WARNINGS=file</code></a></li>
|
|
<li><a href="#cli_node_repl_history_file"><code>NODE_REPL_HISTORY=file</code></a></li>
|
|
<li><a href="#cli_node_repl_external_module_file"><code>NODE_REPL_EXTERNAL_MODULE=file</code></a></li>
|
|
<li><a href="#cli_node_tls_reject_unauthorized_value"><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code></a></li>
|
|
<li><a href="#cli_node_v8_coverage_dir"><code>NODE_V8_COVERAGE=dir</code></a>
|
|
<ul>
|
|
<li><a href="#cli_coverage_output">Coverage output</a></li>
|
|
<li><a href="#cli_source_map_cache">Source map cache</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#cli_openssl_conf_file"><code>OPENSSL_CONF=file</code></a></li>
|
|
<li><a href="#cli_ssl_cert_dir_dir"><code>SSL_CERT_DIR=dir</code></a></li>
|
|
<li><a href="#cli_ssl_cert_file_file"><code>SSL_CERT_FILE=file</code></a></li>
|
|
<li><a href="#cli_uv_threadpool_size_size"><code>UV_THREADPOOL_SIZE=size</code></a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#cli_useful_v8_options">Useful V8 options</a>
|
|
<ul>
|
|
<li><a href="#cli_max_old_space_size_size_in_megabytes"><code>--max-old-space-size=SIZE</code> (in megabytes)</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="apicontent">
|
|
<h1>Command line options<span><a class="mark" href="#cli_command_line_options" id="cli_command_line_options">#</a></span></h1>
|
|
|
|
|
|
<p>Node.js comes with a variety of CLI options. These options expose built-in
|
|
debugging, multiple ways to execute scripts, and other helpful runtime options.</p>
|
|
<p>To view this documentation as a manual page in a terminal, run <code>man node</code>.</p>
|
|
<h2>Synopsis<span><a class="mark" href="#cli_synopsis" id="cli_synopsis">#</a></span></h2>
|
|
<p><code>node [options] [V8 options] [script.js | -e "script" | -] [--] [arguments]</code></p>
|
|
<p><code>node inspect [script.js | -e "script" | <host>:<port>] …</code></p>
|
|
<p><code>node --v8-options</code></p>
|
|
<p>Execute without arguments to start the <a href="repl.html">REPL</a>.</p>
|
|
<p><em>For more info about <code>node inspect</code>, please see the <a href="debugger.html">debugger</a> documentation.</em></p>
|
|
<h2>Options<span><a class="mark" href="#cli_options" id="cli_options">#</a></span></h2>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v10.12.0</td>
|
|
<td><p>Underscores instead of dashes are now allowed for Node.js options as well, in addition to V8 options.</p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>All options, including V8 options, allow words to be separated by both
|
|
dashes (<code>-</code>) or underscores (<code>_</code>).</p>
|
|
<p>For example, <code>--pending-deprecation</code> is equivalent to <code>--pending_deprecation</code>.</p>
|
|
<p>If an option that takes a single value, for example <code>--max-http-header-size</code>,
|
|
is passed more than once, then the last passed value will be used. Options
|
|
from the command line take precedence over options passed through the
|
|
<a href="#cli_node_options_options"><code>NODE_OPTIONS</code></a> environment variable.</p>
|
|
<h3><code>-</code><span><a class="mark" href="#cli" id="cli">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>Alias for stdin. Analogous to the use of <code>-</code> in other command line utilities,
|
|
meaning that the script will be read from stdin, and the rest of the options
|
|
are passed to that script.</p>
|
|
<h3><code>--</code><span><a class="mark" href="#cli_1" id="cli_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.11.0</span>
|
|
</div>
|
|
<p>Indicate the end of node options. Pass the rest of the arguments to the script.
|
|
If no script filename or eval/print script is supplied prior to this, then
|
|
the next argument will be used as a script filename.</p>
|
|
<h3><code>--abort-on-uncaught-exception</code><span><a class="mark" href="#cli_abort_on_uncaught_exception" id="cli_abort_on_uncaught_exception">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.10.8</span>
|
|
</div>
|
|
<p>Aborting instead of exiting causes a core file to be generated for post-mortem
|
|
analysis using a debugger (such as <code>lldb</code>, <code>gdb</code>, and <code>mdb</code>).</p>
|
|
<p>If this flag is passed, the behavior can still be set to not abort through
|
|
<a href="process.html#process_process_setuncaughtexceptioncapturecallback_fn"><code>process.setUncaughtExceptionCaptureCallback()</code></a> (and through usage of the
|
|
<code>domain</code> module that uses it).</p>
|
|
<h3><code>--completion-bash</code><span><a class="mark" href="#cli_completion_bash" id="cli_completion_bash">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v10.12.0</span>
|
|
</div>
|
|
<p>Print source-able bash completion script for Node.js.</p>
|
|
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> node --completion-bash > node_bash_completion</span>
|
|
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">source</span> node_bash_completion</span></code></pre>
|
|
<h3><code>--conditions=condition</code><span><a class="mark" href="#cli_conditions_condition" id="cli_conditions_condition">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.19.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Enable experimental support for custom conditional exports resolution
|
|
conditions.</p>
|
|
<p>Any number of custom string condition names are permitted.</p>
|
|
<p>The default Node.js conditions of <code>"node"</code>, <code>"default"</code>, <code>"import"</code>, and
|
|
<code>"require"</code> will always apply as defined.</p>
|
|
<h3><code>--cpu-prof</code><span><a class="mark" href="#cli_cpu_prof" id="cli_cpu_prof">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Starts the V8 CPU profiler on start up, and writes the CPU profile to disk
|
|
before exit.</p>
|
|
<p>If <code>--cpu-prof-dir</code> is not specified, the generated profile will be placed
|
|
in the current working directory.</p>
|
|
<p>If <code>--cpu-prof-name</code> is not specified, the generated profile will be
|
|
named <code>CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile</code>.</p>
|
|
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> node --cpu-prof index.js</span>
|
|
<span class="hljs-meta">$</span><span class="bash"> ls *.cpuprofile</span>
|
|
CPU.20190409.202950.15293.0.0.cpuprofile</code></pre>
|
|
<h3><code>--cpu-prof-dir</code><span><a class="mark" href="#cli_cpu_prof_dir" id="cli_cpu_prof_dir">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the directory where the CPU profiles generated by <code>--cpu-prof</code> will
|
|
be placed.</p>
|
|
<p>The default value is controlled by the
|
|
<a href="#cli_diagnostic_dir_directory">--diagnostic-dir</a> command line option.</p>
|
|
<h3><code>--cpu-prof-interval</code><span><a class="mark" href="#cli_cpu_prof_interval" id="cli_cpu_prof_interval">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.2.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the sampling interval in microseconds for the CPU profiles generated
|
|
by <code>--cpu-prof</code>. The default is 1000 microseconds.</p>
|
|
<h3><code>--cpu-prof-name</code><span><a class="mark" href="#cli_cpu_prof_name" id="cli_cpu_prof_name">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the file name of the CPU profile generated by <code>--cpu-prof</code>.</p>
|
|
<h3><code>--diagnostic-dir=directory</code><span><a class="mark" href="#cli_diagnostic_dir_directory" id="cli_diagnostic_dir_directory">#</a></span></h3>
|
|
<p>Set the directory to which all diagnostic output files will be written to.
|
|
Defaults to current working directory.</p>
|
|
<p>Affects the default output directory of:</p>
|
|
<ul>
|
|
<li><a href="#cli_cpu_prof_dir">--cpu-prof-dir</a></li>
|
|
<li><a href="#cli_heap_prof_dir">--heap-prof-dir</a></li>
|
|
<li><a href="#cli_redirect_warnings_file">--redirect-warnings</a></li>
|
|
</ul>
|
|
<h3><code>--disable-proto=mode</code><span><a class="mark" href="#cli_disable_proto_mode" id="cli_disable_proto_mode">#</a></span></h3>
|
|
<!--YAML
|
|
added: v12.17.0
|
|
-->
|
|
<p>Disable the <code>Object.prototype.__proto__</code> property. If <code>mode</code> is <code>delete</code>, the
|
|
property will be removed entirely. If <code>mode</code> is <code>throw</code>, accesses to the
|
|
property will throw an exception with the code <code>ERR_PROTO_ACCESS</code>.</p>
|
|
<h3><code>--disallow-code-generation-from-strings</code><span><a class="mark" href="#cli_disallow_code_generation_from_strings" id="cli_disallow_code_generation_from_strings">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v9.8.0</span>
|
|
</div>
|
|
<p>Make built-in language features like <code>eval</code> and <code>new Function</code> that generate
|
|
code from strings throw an exception instead. This does not affect the Node.js
|
|
<code>vm</code> module.</p>
|
|
<h3><code>--enable-fips</code><span><a class="mark" href="#cli_enable_fips" id="cli_enable_fips">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.0.0</span>
|
|
</div>
|
|
<p>Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with
|
|
<code>./configure --openssl-fips</code>.)</p>
|
|
<h3><code>--enable-source-maps</code><span><a class="mark" href="#cli_enable_source_maps" id="cli_enable_source_maps">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.12.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Enable experimental Source Map v3 support for stack traces.</p>
|
|
<p>Currently, overriding <code>Error.prepareStackTrace</code> is ignored when the
|
|
<code>--enable-source-maps</code> flag is set.</p>
|
|
<h3><code>--experimental-import-meta-resolve</code><span><a class="mark" href="#cli_experimental_import_meta_resolve" id="cli_experimental_import_meta_resolve">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.2</span>
|
|
</div>
|
|
<p>Enable experimental <code>import.meta.resolve()</code> support.</p>
|
|
<h3><code>--experimental-json-modules</code><span><a class="mark" href="#cli_experimental_json_modules" id="cli_experimental_json_modules">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.9.0</span>
|
|
</div>
|
|
<p>Enable experimental JSON support for the ES Module loader.</p>
|
|
<h3><code>--experimental-loader=module</code><span><a class="mark" href="#cli_experimental_loader_module" id="cli_experimental_loader_module">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v9.0.0</span>
|
|
</div>
|
|
<p>Specify the <code>module</code> of a custom <a href="esm.html#esm_experimental_loaders">experimental ECMAScript Module loader</a>.
|
|
<code>module</code> may be either a path to a file, or an ECMAScript Module name.</p>
|
|
<h3><code>--experimental-modules</code><span><a class="mark" href="#cli_experimental_modules" id="cli_experimental_modules">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.5.0</span>
|
|
</div>
|
|
<p>Enable latest experimental modules features (deprecated).</p>
|
|
<h3><code>--experimental-policy</code><span><a class="mark" href="#cli_experimental_policy" id="cli_experimental_policy">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v11.8.0</span>
|
|
</div>
|
|
<p>Use the specified file as a security policy.</p>
|
|
<h3><code>--experimental-repl-await</code><span><a class="mark" href="#cli_experimental_repl_await" id="cli_experimental_repl_await">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v10.0.0</span>
|
|
</div>
|
|
<p>Enable experimental top-level <code>await</code> keyword support in REPL.</p>
|
|
<h3><code>--experimental-specifier-resolution=mode</code><span><a class="mark" href="#cli_experimental_specifier_resolution_mode" id="cli_experimental_specifier_resolution_mode">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Sets the resolution algorithm for resolving ES module specifiers. Valid options
|
|
are <code>explicit</code> and <code>node</code>.</p>
|
|
<p>The default is <code>explicit</code>, which requires providing the full path to a
|
|
module. The <code>node</code> mode will enable support for optional file extensions and
|
|
the ability to import a directory that has an index file.</p>
|
|
<p>Please see <a href="esm.html#esm_customizing_esm_specifier_resolution_algorithm">customizing ESM specifier resolution</a> for example usage.</p>
|
|
<h3><code>--experimental-vm-modules</code><span><a class="mark" href="#cli_experimental_vm_modules" id="cli_experimental_vm_modules">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v9.6.0</span>
|
|
</div>
|
|
<p>Enable experimental ES Module support in the <code>vm</code> module.</p>
|
|
<h3><code>--experimental-wasi-unstable-preview1</code><span><a class="mark" href="#cli_experimental_wasi_unstable_preview1" id="cli_experimental_wasi_unstable_preview1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Enable experimental WebAssembly System Interface (WASI) support.</p>
|
|
<h3><code>--experimental-wasm-modules</code><span><a class="mark" href="#cli_experimental_wasm_modules" id="cli_experimental_wasm_modules">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.3.0</span>
|
|
</div>
|
|
<h3><code>--force-context-aware</code><span><a class="mark" href="#cli_force_context_aware" id="cli_force_context_aware">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.12.0</span>
|
|
</div>
|
|
<p>Disable loading native addons that are not <a href="addons.html#addons_context_aware_addons">context-aware</a>.</p>
|
|
<p>Enable experimental WebAssembly module support.</p>
|
|
<h3><code>--force-fips</code><span><a class="mark" href="#cli_force_fips" id="cli_force_fips">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.0.0</span>
|
|
</div>
|
|
<p>Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)
|
|
(Same requirements as <code>--enable-fips</code>.)</p>
|
|
<h3><code>--frozen-intrinsics</code><span><a class="mark" href="#cli_frozen_intrinsics" id="cli_frozen_intrinsics">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v11.12.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Enable experimental frozen intrinsics like <code>Array</code> and <code>Object</code>.</p>
|
|
<p>Support is currently only provided for the root context and no guarantees are
|
|
currently provided that <code>global.Array</code> is indeed the default intrinsic
|
|
reference. Code may break under this flag.</p>
|
|
<p><code>--require</code> runs prior to freezing intrinsics in order to allow polyfills to
|
|
be added.</p>
|
|
<h3><code>--heapsnapshot-signal=signal</code><span><a class="mark" href="#cli_heapsnapshot_signal_signal" id="cli_heapsnapshot_signal_signal">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Enables a signal handler that causes the Node.js process to write a heap dump
|
|
when the specified signal is received. <code>signal</code> must be a valid signal name.
|
|
Disabled by default.</p>
|
|
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> node --heapsnapshot-signal=SIGUSR2 index.js &</span>
|
|
<span class="hljs-meta">$</span><span class="bash"> ps aux</span>
|
|
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
|
|
node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js
|
|
<span class="hljs-meta">$</span><span class="bash"> <span class="hljs-built_in">kill</span> -USR2 1</span>
|
|
<span class="hljs-meta">$</span><span class="bash"> ls</span>
|
|
Heap.20190718.133405.15554.0.001.heapsnapshot</code></pre>
|
|
<h3><code>--heap-prof</code><span><a class="mark" href="#cli_heap_prof" id="cli_heap_prof">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.4.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Starts the V8 heap profiler on start up, and writes the heap profile to disk
|
|
before exit.</p>
|
|
<p>If <code>--heap-prof-dir</code> is not specified, the generated profile will be placed
|
|
in the current working directory.</p>
|
|
<p>If <code>--heap-prof-name</code> is not specified, the generated profile will be
|
|
named <code>Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile</code>.</p>
|
|
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> node --heap-prof index.js</span>
|
|
<span class="hljs-meta">$</span><span class="bash"> ls *.heapprofile</span>
|
|
Heap.20190409.202950.15293.0.001.heapprofile</code></pre>
|
|
<h3><code>--heap-prof-dir</code><span><a class="mark" href="#cli_heap_prof_dir" id="cli_heap_prof_dir">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.4.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the directory where the heap profiles generated by <code>--heap-prof</code> will
|
|
be placed.</p>
|
|
<p>The default value is controlled by the
|
|
<a href="#cli_diagnostic_dir_directory">--diagnostic-dir</a> command line option.</p>
|
|
<h3><code>--heap-prof-interval</code><span><a class="mark" href="#cli_heap_prof_interval" id="cli_heap_prof_interval">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.4.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the average sampling interval in bytes for the heap profiles generated
|
|
by <code>--heap-prof</code>. The default is 512 * 1024 bytes.</p>
|
|
<h3><code>--heap-prof-name</code><span><a class="mark" href="#cli_heap_prof_name" id="cli_heap_prof_name">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.4.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Specify the file name of the heap profile generated by <code>--heap-prof</code>.</p>
|
|
<h3><code>--http-parser=library</code><span><a class="mark" href="#cli_http_parser_library" id="cli_http_parser_library">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.22.0</td>
|
|
<td><p>The legacy HTTP parser will emit a deprecation warning.</p></td></tr>
|
|
<tr><td>v11.4.0</td>
|
|
<td><p><span>Added in: v11.4.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Chooses an HTTP parser library. Available values are:</p>
|
|
<ul>
|
|
<li><code>llhttp</code> for <a href="https://llhttp.org/">https://llhttp.org/</a></li>
|
|
<li><code>legacy</code> for <a href="https://github.com/nodejs/http-parser">https://github.com/nodejs/http-parser</a></li>
|
|
</ul>
|
|
<p>The default is <code>llhttp</code>, unless otherwise specified when building Node.js.</p>
|
|
<p>The <code>legacy</code> HTTP parser is deprecated and will emit a deprecation warning.</p>
|
|
<p>This flag exists to aid in experimentation with the internal implementation of
|
|
the Node.js http parser.
|
|
This flag is likely to become a no-op and removed at some point in the future.</p>
|
|
<h3><code>--http-server-default-timeout=milliseconds</code><span><a class="mark" href="#cli_http_server_default_timeout_milliseconds" id="cli_http_server_default_timeout_milliseconds">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.4.0</span>
|
|
</div>
|
|
<p>Overrides the default value of <code>http</code>, <code>https</code> and <code>http2</code> server socket
|
|
timeout. Setting the value to 0 disables server socket timeout. Unless
|
|
provided, http server sockets timeout after 120s (2 minutes). Programmatic
|
|
setting of the timeout takes precedence over the value set through this
|
|
flag.</p>
|
|
<h3><code>--icu-data-dir=file</code><span><a class="mark" href="#cli_icu_data_dir_file" id="cli_icu_data_dir_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.11.15</span>
|
|
</div>
|
|
<p>Specify ICU data load path. (Overrides <code>NODE_ICU_DATA</code>.)</p>
|
|
<h3><code>--input-type=type</code><span><a class="mark" href="#cli_input_type_type" id="cli_input_type_type">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>This configures Node.js to interpret string input as CommonJS or as an ES
|
|
module. String input is input via <code>--eval</code>, <code>--print</code>, or <code>STDIN</code>.</p>
|
|
<p>Valid values are <code>"commonjs"</code> and <code>"module"</code>. The default is <code>"commonjs"</code>.</p>
|
|
<h3><code>--inspect-brk[=[host:]port]</code><span><a class="mark" href="#cli_inspect_brk_host_port" id="cli_inspect_brk_host_port">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.6.0</span>
|
|
</div>
|
|
<p>Activate inspector on <code>host:port</code> and break at start of user script.
|
|
Default <code>host:port</code> is <code>127.0.0.1:9229</code>.</p>
|
|
<h3><code>--inspect-port=[host:]port</code><span><a class="mark" href="#cli_inspect_port_host_port" id="cli_inspect_port_host_port">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.6.0</span>
|
|
</div>
|
|
<p>Set the <code>host:port</code> to be used when the inspector is activated.
|
|
Useful when activating the inspector by sending the <code>SIGUSR1</code> signal.</p>
|
|
<p>Default host is <code>127.0.0.1</code>.</p>
|
|
<p>See the <a href="#inspector_security">security warning</a> below regarding the <code>host</code>
|
|
parameter usage.</p>
|
|
<h3><code>--inspect[=[host:]port]</code><span><a class="mark" href="#cli_inspect_host_port" id="cli_inspect_host_port">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.3.0</span>
|
|
</div>
|
|
<p>Activate inspector on <code>host:port</code>. Default is <code>127.0.0.1:9229</code>.</p>
|
|
<p>V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
|
|
and profile Node.js instances. The tools attach to Node.js instances via a
|
|
tcp port and communicate using the <a href="https://chromedevtools.github.io/devtools-protocol/">Chrome DevTools Protocol</a>.</p>
|
|
<p><a id="inspector_security"></a></p>
|
|
<h4>Warning: binding inspector to a public IP:port combination is insecure<span><a class="mark" href="#cli_warning_binding_inspector_to_a_public_ip_port_combination_is_insecure" id="cli_warning_binding_inspector_to_a_public_ip_port_combination_is_insecure">#</a></span></h4>
|
|
<p>Binding the inspector to a public IP (including <code>0.0.0.0</code>) with an open port is
|
|
insecure, as it allows external hosts to connect to the inspector and perform
|
|
a <a href="https://www.owasp.org/index.php/Code_Injection">remote code execution</a> attack.</p>
|
|
<p>If specifying a host, make sure that either:</p>
|
|
<ul>
|
|
<li>The host is not accessible from public networks.</li>
|
|
<li>A firewall disallows unwanted connections on the port.</li>
|
|
</ul>
|
|
<p><strong>More specifically, <code>--inspect=0.0.0.0</code> is insecure if the port (<code>9229</code> by
|
|
default) is not firewall-protected.</strong></p>
|
|
<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>
|
|
<h3><code>--inspect-publish-uid=stderr,http</code><span><a class="mark" href="#cli_inspect_publish_uid_stderr_http" id="cli_inspect_publish_uid_stderr_http">#</a></span></h3>
|
|
<p>Specify ways of the inspector web socket url exposure.</p>
|
|
<p>By default inspector websocket url is available in stderr and under <code>/json/list</code>
|
|
endpoint on <code>http://host:port/json/list</code>.</p>
|
|
<h3><code>--insecure-http-parser</code><span><a class="mark" href="#cli_insecure_http_parser" id="cli_insecure_http_parser">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.15.0</span>
|
|
</div>
|
|
<p>Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow
|
|
interoperability with non-conformant HTTP implementations. It may also allow
|
|
request smuggling and other HTTP attacks that rely on invalid headers being
|
|
accepted. Avoid using this option.</p>
|
|
<h3><code>--jitless</code><span><a class="mark" href="#cli_jitless" id="cli_jitless">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Disable <a href="https://v8.dev/blog/jitless">runtime allocation of executable memory</a>. This may be
|
|
required on some platforms for security reasons. It can also reduce attack
|
|
surface on other platforms, but the performance impact may be severe.</p>
|
|
<p>This flag is inherited from V8 and is subject to change upstream. It may
|
|
disappear in a non-semver-major release.</p>
|
|
<h3><code>--max-http-header-size=size</code><span><a class="mark" href="#cli_max_http_header_size_size" id="cli_max_http_header_size_size">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v11.6.0</span>
|
|
</div>
|
|
<p>Specify the maximum size, in bytes, of HTTP headers. Defaults to 8KB.</p>
|
|
<h3><code>--napi-modules</code><span><a class="mark" href="#cli_napi_modules" id="cli_napi_modules">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.10.0</span>
|
|
</div>
|
|
<p>This option is a no-op. It is kept for compatibility.</p>
|
|
<h3><code>--no-deprecation</code><span><a class="mark" href="#cli_no_deprecation" id="cli_no_deprecation">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.8.0</span>
|
|
</div>
|
|
<p>Silence deprecation warnings.</p>
|
|
<h3><code>--no-force-async-hooks-checks</code><span><a class="mark" href="#cli_no_force_async_hooks_checks" id="cli_no_force_async_hooks_checks">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v9.0.0</span>
|
|
</div>
|
|
<p>Disables runtime checks for <code>async_hooks</code>. These will still be enabled
|
|
dynamically when <code>async_hooks</code> is enabled.</p>
|
|
<h3><code>--no-warnings</code><span><a class="mark" href="#cli_no_warnings" id="cli_no_warnings">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.0.0</span>
|
|
</div>
|
|
<p>Silence all process warnings (including deprecations).</p>
|
|
<h3><code>--openssl-config=file</code><span><a class="mark" href="#cli_openssl_config_file" id="cli_openssl_config_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.9.0</span>
|
|
</div>
|
|
<p>Load an OpenSSL configuration file on startup. Among other uses, this can be
|
|
used to enable FIPS-compliant crypto if Node.js is built with
|
|
<code>./configure --openssl-fips</code>.</p>
|
|
<h3><code>--pending-deprecation</code><span><a class="mark" href="#cli_pending_deprecation" id="cli_pending_deprecation">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>Emit pending deprecation warnings.</p>
|
|
<p>Pending deprecations are generally identical to a runtime deprecation with the
|
|
notable exception that they are turned <em>off</em> by default and will not be emitted
|
|
unless either the <code>--pending-deprecation</code> command line flag, or the
|
|
<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations
|
|
are used to provide a kind of selective "early warning" mechanism that
|
|
developers may leverage to detect deprecated API usage.</p>
|
|
<h3><code>--policy-integrity=sri</code><span><a class="mark" href="#cli_policy_integrity_sri" id="cli_policy_integrity_sri">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.7.0</span>
|
|
</div>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>Instructs Node.js to error prior to running any code if the policy does not have
|
|
the specified integrity. It expects a <a href="https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity">Subresource Integrity</a> string as a
|
|
parameter.</p>
|
|
<h3><code>--preserve-symlinks</code><span><a class="mark" href="#cli_preserve_symlinks" id="cli_preserve_symlinks">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.3.0</span>
|
|
</div>
|
|
<p>Instructs the module loader to preserve symbolic links when resolving and
|
|
caching modules.</p>
|
|
<p>By default, when Node.js loads a module from a path that is symbolically linked
|
|
to a different on-disk location, Node.js will dereference the link and use the
|
|
actual on-disk "real path" of the module as both an identifier and as a root
|
|
path to locate other dependency modules. In most cases, this default behavior
|
|
is acceptable. However, when using symbolically linked peer dependencies, as
|
|
illustrated in the example below, the default behavior causes an exception to
|
|
be thrown if <code>moduleA</code> attempts to require <code>moduleB</code> as a peer dependency:</p>
|
|
<pre><code class="language-text">{appDir}
|
|
├── app
|
|
│ ├── index.js
|
|
│ └── node_modules
|
|
│ ├── moduleA -> {appDir}/moduleA
|
|
│ └── moduleB
|
|
│ ├── index.js
|
|
│ └── package.json
|
|
└── moduleA
|
|
├── index.js
|
|
└── package.json</code></pre>
|
|
<p>The <code>--preserve-symlinks</code> command line flag instructs Node.js to use the
|
|
symlink path for modules as opposed to the real path, allowing symbolically
|
|
linked peer dependencies to be found.</p>
|
|
<p>Note, however, that using <code>--preserve-symlinks</code> can have other side effects.
|
|
Specifically, symbolically linked <em>native</em> modules can fail to load if those
|
|
are linked from more than one location in the dependency tree (Node.js would
|
|
see those as two separate modules and would attempt to load the module multiple
|
|
times, causing an exception to be thrown).</p>
|
|
<p>The <code>--preserve-symlinks</code> flag does not apply to the main module, which allows
|
|
<code>node --preserve-symlinks node_module/.bin/<foo></code> to work. To apply the same
|
|
behavior for the main module, also use <code>--preserve-symlinks-main</code>.</p>
|
|
<h3><code>--preserve-symlinks-main</code><span><a class="mark" href="#cli_preserve_symlinks_main" id="cli_preserve_symlinks_main">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v10.2.0</span>
|
|
</div>
|
|
<p>Instructs the module loader to preserve symbolic links when resolving and
|
|
caching the main module (<code>require.main</code>).</p>
|
|
<p>This flag exists so that the main module can be opted-in to the same behavior
|
|
that <code>--preserve-symlinks</code> gives to all other imports; they are separate flags,
|
|
however, for backward compatibility with older Node.js versions.</p>
|
|
<p><code>--preserve-symlinks-main</code> does not imply <code>--preserve-symlinks</code>; it
|
|
is expected that <code>--preserve-symlinks-main</code> will be used in addition to
|
|
<code>--preserve-symlinks</code> when it is not desirable to follow symlinks before
|
|
resolving relative paths.</p>
|
|
<p>See <code>--preserve-symlinks</code> for more information.</p>
|
|
<h3><code>--prof</code><span><a class="mark" href="#cli_prof" id="cli_prof">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v2.0.0</span>
|
|
</div>
|
|
<p>Generate V8 profiler output.</p>
|
|
<h3><code>--prof-process</code><span><a class="mark" href="#cli_prof_process" id="cli_prof_process">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v5.2.0</span>
|
|
</div>
|
|
<p>Process V8 profiler output generated using the V8 option <code>--prof</code>.</p>
|
|
<h3><code>--redirect-warnings=file</code><span><a class="mark" href="#cli_redirect_warnings_file" id="cli_redirect_warnings_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>Write process warnings to the given file instead of printing to stderr. The
|
|
file will be created if it does not exist, and will be appended to if it does.
|
|
If an error occurs while attempting to write the warning to the file, the
|
|
warning will be written to stderr instead.</p>
|
|
<p>The <code>file</code> name may be an absolute path. If it is not, the default directory it
|
|
will be written to is controlled by the
|
|
<a href="#cli_diagnostic_dir_directory">--diagnostic-dir</a> command line option.</p>
|
|
<h3><code>--report-compact</code><span><a class="mark" href="#cli_report_compact" id="cli_report_compact">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.17.0</span>
|
|
</div>
|
|
<p>Write reports in a compact format, single-line JSON, more easily consumable
|
|
by log processing systems than the default multi-line format designed for
|
|
human consumption.</p>
|
|
<h3><code>--report-dir=directory</code>, <code>report-directory=directory</code><span><a class="mark" href="#cli_report_dir_directory_report_directory_directory" id="cli_report_dir_directory_report_directory_directory">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>Changed from <code>--diagnostic-report-directory</code> to <code>--report-directory</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Location at which the report will be generated.</p>
|
|
<h3><code>--report-filename=filename</code><span><a class="mark" href="#cli_report_filename_filename" id="cli_report_filename_filename">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>changed from <code>--diagnostic-report-filename</code> to <code>--report-filename</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Name of the file to which the report will be written.</p>
|
|
<h3><code>--report-on-fatalerror</code><span><a class="mark" href="#cli_report_on_fatalerror" id="cli_report_on_fatalerror">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>changed from <code>--diagnostic-report-on-fatalerror</code> to <code>--report-on-fatalerror</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Enables the report to be triggered on fatal errors (internal errors within
|
|
the Node.js runtime such as out of memory) that lead to termination of the
|
|
application. Useful to inspect various diagnostic data elements such as heap,
|
|
stack, event loop state, resource consumption etc. to reason about the fatal
|
|
error.</p>
|
|
<h3><code>--report-on-signal</code><span><a class="mark" href="#cli_report_on_signal" id="cli_report_on_signal">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>changed from <code>--diagnostic-report-on-signal</code> to <code>--report-on-signal</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Enables report to be generated upon receiving the specified (or predefined)
|
|
signal to the running Node.js process. The signal to trigger the report is
|
|
specified through <code>--report-signal</code>.</p>
|
|
<h3><code>--report-signal=signal</code><span><a class="mark" href="#cli_report_signal_signal" id="cli_report_signal_signal">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>changed from <code>--diagnostic-report-signal</code> to <code>--report-signal</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Sets or resets the signal for report generation (not supported on Windows).
|
|
Default signal is <code>SIGUSR2</code>.</p>
|
|
<h3><code>--report-uncaught-exception</code><span><a class="mark" href="#cli_report_uncaught_exception" id="cli_report_uncaught_exception">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v12.17.0</td>
|
|
<td><p>This option is no longer experimental.</p></td></tr>
|
|
<tr><td>v12.0.0</td>
|
|
<td><p>changed from <code>--diagnostic-report-uncaught-exception</code> to <code>--report-uncaught-exception</code></p></td></tr>
|
|
<tr><td>v11.8.0</td>
|
|
<td><p><span>Added in: v11.8.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Enables report to be generated on uncaught exceptions. Useful when inspecting
|
|
the JavaScript stack in conjunction with native stack and other runtime
|
|
environment data.</p>
|
|
<h3><code>--throw-deprecation</code><span><a class="mark" href="#cli_throw_deprecation" id="cli_throw_deprecation">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.11.14</span>
|
|
</div>
|
|
<p>Throw errors for deprecations.</p>
|
|
<h3><code>--title=title</code><span><a class="mark" href="#cli_title_title" id="cli_title_title">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v10.7.0</span>
|
|
</div>
|
|
<p>Set <code>process.title</code> on startup.</p>
|
|
<h3><code>--tls-cipher-list=list</code><span><a class="mark" href="#cli_tls_cipher_list_list" id="cli_tls_cipher_list_list">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v4.0.0</span>
|
|
</div>
|
|
<p>Specify an alternative default TLS cipher list. Requires Node.js to be built
|
|
with crypto support (default).</p>
|
|
<h3><code>--tls-keylog=file</code><span><a class="mark" href="#cli_tls_keylog_file" id="cli_tls_keylog_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Log TLS key material to a file. The key material is in NSS <code>SSLKEYLOGFILE</code>
|
|
format and can be used by software (such as Wireshark) to decrypt the TLS
|
|
traffic.</p>
|
|
<h3><code>--tls-max-v1.2</code><span><a class="mark" href="#cli_tls_max_v1_2" id="cli_tls_max_v1_2">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Set <a href="tls.html#tls_tls_default_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.2'. Use to disable support for
|
|
TLSv1.3.</p>
|
|
<h3><code>--tls-max-v1.3</code><span><a class="mark" href="#cli_tls_max_v1_3" id="cli_tls_max_v1_3">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Set default <a href="tls.html#tls_tls_default_max_version"><code>tls.DEFAULT_MAX_VERSION</code></a> to 'TLSv1.3'. Use to enable support
|
|
for TLSv1.3.</p>
|
|
<h3><code>--tls-min-v1.0</code><span><a class="mark" href="#cli_tls_min_v1_0" id="cli_tls_min_v1_0">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Set default <a href="tls.html#tls_tls_default_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1'. Use for compatibility with
|
|
old TLS clients or servers.</p>
|
|
<h3><code>--tls-min-v1.1</code><span><a class="mark" href="#cli_tls_min_v1_1" id="cli_tls_min_v1_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Set default <a href="tls.html#tls_tls_default_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.1'. Use for compatibility
|
|
with old TLS clients or servers.</p>
|
|
<h3><code>--tls-min-v1.2</code><span><a class="mark" href="#cli_tls_min_v1_2" id="cli_tls_min_v1_2">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.2.0</span>
|
|
</div>
|
|
<p>Set default <a href="tls.html#tls_tls_default_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.2'. This is the default for
|
|
12.x and later, but the option is supported for compatibility with older Node.js
|
|
versions.</p>
|
|
<h3><code>--tls-min-v1.3</code><span><a class="mark" href="#cli_tls_min_v1_3" id="cli_tls_min_v1_3">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>Set default <a href="tls.html#tls_tls_default_min_version"><code>tls.DEFAULT_MIN_VERSION</code></a> to 'TLSv1.3'. Use to disable support
|
|
for TLSv1.2, which is not as secure as TLSv1.3.</p>
|
|
<h3><code>--trace-deprecation</code><span><a class="mark" href="#cli_trace_deprecation" id="cli_trace_deprecation">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.8.0</span>
|
|
</div>
|
|
<p>Print stack traces for deprecations.</p>
|
|
<h3><code>--trace-event-categories</code><span><a class="mark" href="#cli_trace_event_categories" id="cli_trace_event_categories">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.7.0</span>
|
|
</div>
|
|
<p>A comma separated list of categories that should be traced when trace event
|
|
tracing is enabled using <code>--trace-events-enabled</code>.</p>
|
|
<h3><code>--trace-event-file-pattern</code><span><a class="mark" href="#cli_trace_event_file_pattern" id="cli_trace_event_file_pattern">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v9.8.0</span>
|
|
</div>
|
|
<p>Template string specifying the filepath for the trace event data, it
|
|
supports <code>${rotation}</code> and <code>${pid}</code>.</p>
|
|
<h3><code>--trace-events-enabled</code><span><a class="mark" href="#cli_trace_events_enabled" id="cli_trace_events_enabled">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.7.0</span>
|
|
</div>
|
|
<p>Enables the collection of trace event tracing information.</p>
|
|
<h3><code>--trace-exit</code><span><a class="mark" href="#cli_trace_exit" id="cli_trace_exit">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Prints a stack trace whenever an environment is exited proactively,
|
|
i.e. invoking <code>process.exit()</code>.</p>
|
|
<h3><code>--trace-sigint</code><span><a class="mark" href="#cli_trace_sigint" id="cli_trace_sigint">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.17.0</span>
|
|
</div>
|
|
<p>Prints a stack trace on SIGINT.</p>
|
|
<h3><code>--trace-sync-io</code><span><a class="mark" href="#cli_trace_sync_io" id="cli_trace_sync_io">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v2.1.0</span>
|
|
</div>
|
|
<p>Prints a stack trace whenever synchronous I/O is detected after the first turn
|
|
of the event loop.</p>
|
|
<h3><code>--trace-tls</code><span><a class="mark" href="#cli_trace_tls" id="cli_trace_tls">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.2.0</span>
|
|
</div>
|
|
<p>Prints TLS packet trace information to <code>stderr</code>. This can be used to debug TLS
|
|
connection problems.</p>
|
|
<h3><code>--trace-uncaught</code><span><a class="mark" href="#cli_trace_uncaught" id="cli_trace_uncaught">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Print stack traces for uncaught exceptions; usually, the stack trace associated
|
|
with the creation of an <code>Error</code> is printed, whereas this makes Node.js also
|
|
print the stack trace associated with throwing the value (which does not need
|
|
to be an <code>Error</code> instance).</p>
|
|
<p>Enabling this option may affect garbage collection behavior negatively.</p>
|
|
<h3><code>--trace-warnings</code><span><a class="mark" href="#cli_trace_warnings" id="cli_trace_warnings">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.0.0</span>
|
|
</div>
|
|
<p>Print stack traces for process warnings (including deprecations).</p>
|
|
<h3><code>--track-heap-objects</code><span><a class="mark" href="#cli_track_heap_objects" id="cli_track_heap_objects">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v2.4.0</span>
|
|
</div>
|
|
<p>Track heap object allocations for heap snapshots.</p>
|
|
<h3><code>--unhandled-rejections=mode</code><span><a class="mark" href="#cli_unhandled_rejections_mode" id="cli_unhandled_rejections_mode">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.0.0</span>
|
|
</div>
|
|
<p>By default all unhandled rejections trigger a warning plus a deprecation warning
|
|
for the very first unhandled rejection in case no <a href="process.html#process_event_unhandledrejection"><code>unhandledRejection</code></a> hook
|
|
is used.</p>
|
|
<p>Using this flag allows to change what should happen when an unhandled rejection
|
|
occurs. One of three modes can be chosen:</p>
|
|
<ul>
|
|
<li><code>strict</code>: Raise the unhandled rejection as an uncaught exception.</li>
|
|
<li><code>warn</code>: Always trigger a warning, no matter if the <a href="process.html#process_event_unhandledrejection"><code>unhandledRejection</code></a>
|
|
hook is set or not but do not print the deprecation warning.</li>
|
|
<li><code>none</code>: Silence all warnings.</li>
|
|
</ul>
|
|
<h3><code>--use-bundled-ca</code>, <code>--use-openssl-ca</code><span><a class="mark" href="#cli_use_bundled_ca_use_openssl_ca" id="cli_use_bundled_ca_use_openssl_ca">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.11.0</span>
|
|
</div>
|
|
<p>Use bundled Mozilla CA store as supplied by current Node.js version
|
|
or use OpenSSL's default CA store. The default store is selectable
|
|
at build-time.</p>
|
|
<p>The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store
|
|
that is fixed at release time. It is identical on all supported platforms.</p>
|
|
<p>Using OpenSSL store allows for external modifications of the store. For most
|
|
Linux and BSD distributions, this store is maintained by the distribution
|
|
maintainers and system administrators. OpenSSL CA store location is dependent on
|
|
configuration of the OpenSSL library but this can be altered at runtime using
|
|
environment variables.</p>
|
|
<p>See <code>SSL_CERT_DIR</code> and <code>SSL_CERT_FILE</code>.</p>
|
|
<h3><code>--use-largepages=mode</code><span><a class="mark" href="#cli_use_largepages_mode" id="cli_use_largepages_mode">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.17.0</span>
|
|
</div>
|
|
<p>Re-map the Node.js static code to large memory pages at startup. If supported on
|
|
the target system, this will cause the Node.js static code to be moved onto 2
|
|
MiB pages instead of 4 KiB pages.</p>
|
|
<p>The following values are valid for <code>mode</code>:</p>
|
|
<ul>
|
|
<li><code>off</code>: No mapping will be attempted. This is the default.</li>
|
|
<li><code>on</code>: If supported by the OS, mapping will be attempted. Failure to map will
|
|
be ignored and a message will be printed to standard error.</li>
|
|
<li><code>silent</code>: If supported by the OS, mapping will be attempted. Failure to map
|
|
will be ignored and will not be reported.</li>
|
|
</ul>
|
|
<h3><code>--v8-options</code><span><a class="mark" href="#cli_v8_options" id="cli_v8_options">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.1.3</span>
|
|
</div>
|
|
<p>Print V8 command line options.</p>
|
|
<h3><code>--v8-pool-size=num</code><span><a class="mark" href="#cli_v8_pool_size_num" id="cli_v8_pool_size_num">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v5.10.0</span>
|
|
</div>
|
|
<p>Set V8's thread pool size which will be used to allocate background jobs.</p>
|
|
<p>If set to <code>0</code> then V8 will choose an appropriate size of the thread pool based
|
|
on the number of online processors.</p>
|
|
<p>If the value provided is larger than V8's maximum, then the largest value
|
|
will be chosen.</p>
|
|
<h3><code>--zero-fill-buffers</code><span><a class="mark" href="#cli_zero_fill_buffers" id="cli_zero_fill_buffers">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.0.0</span>
|
|
</div>
|
|
<p>Automatically zero-fills all newly allocated <a href="buffer.html#buffer_class_buffer"><code>Buffer</code></a> and <a href="buffer.html#buffer_class_slowbuffer"><code>SlowBuffer</code></a>
|
|
instances.</p>
|
|
<h3><code>-c</code>, <code>--check</code><span><a class="mark" href="#cli_c_check" id="cli_c_check">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v10.0.0</td>
|
|
<td><p>The <code>--require</code> option is now supported when checking a file.</p></td></tr>
|
|
<tr><td>v5.0.0, v4.2.0</td>
|
|
<td><p><span>Added in: v5.0.0, v4.2.0</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Syntax check the script without executing.</p>
|
|
<h3><code>-e</code>, <code>--eval "script"</code><span><a class="mark" href="#cli_e_eval_script" id="cli_e_eval_script">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v5.11.0</td>
|
|
<td><p>Built-in libraries are now available as predefined variables.</p></td></tr>
|
|
<tr><td>v0.5.2</td>
|
|
<td><p><span>Added in: v0.5.2</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Evaluate the following argument as JavaScript. The modules which are
|
|
predefined in the REPL can also be used in <code>script</code>.</p>
|
|
<p>On Windows, using <code>cmd.exe</code> a single quote will not work correctly because it
|
|
only recognizes double <code>"</code> for quoting. In Powershell or Git bash, both <code>'</code>
|
|
and <code>"</code> are usable.</p>
|
|
<h3><code>-h</code>, <code>--help</code><span><a class="mark" href="#cli_h_help" id="cli_h_help">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.1.3</span>
|
|
</div>
|
|
<p>Print node command line options.
|
|
The output of this option is less detailed than this document.</p>
|
|
<h3><code>-i</code>, <code>--interactive</code><span><a class="mark" href="#cli_i_interactive" id="cli_i_interactive">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.7.7</span>
|
|
</div>
|
|
<p>Opens the REPL even if stdin does not appear to be a terminal.</p>
|
|
<h3><code>-p</code>, <code>--print "script"</code><span><a class="mark" href="#cli_p_print_script" id="cli_p_print_script">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<details class="changelog"><summary>History</summary>
|
|
<table>
|
|
<tbody><tr><th>Version</th><th>Changes</th></tr>
|
|
<tr><td>v5.11.0</td>
|
|
<td><p>Built-in libraries are now available as predefined variables.</p></td></tr>
|
|
<tr><td>v0.6.4</td>
|
|
<td><p><span>Added in: v0.6.4</span></p></td></tr>
|
|
</tbody></table>
|
|
</details>
|
|
</div>
|
|
<p>Identical to <code>-e</code> but prints the result.</p>
|
|
<h3><code>-r</code>, <code>--require module</code><span><a class="mark" href="#cli_r_require_module" id="cli_r_require_module">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v1.6.0</span>
|
|
</div>
|
|
<p>Preload the specified module at startup.</p>
|
|
<p>Follows <code>require()</code>'s module resolution
|
|
rules. <code>module</code> may be either a path to a file, or a node module name.</p>
|
|
<h3><code>-v</code>, <code>--version</code><span><a class="mark" href="#cli_v_version" id="cli_v_version">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.1.3</span>
|
|
</div>
|
|
<p>Print node's version.</p>
|
|
<h2>Environment variables<span><a class="mark" href="#cli_environment_variables" id="cli_environment_variables">#</a></span></h2>
|
|
<h3><code>NODE_DEBUG=module[,…]</code><span><a class="mark" href="#cli_node_debug_module" id="cli_node_debug_module">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.1.32</span>
|
|
</div>
|
|
<p><code>','</code>-separated list of core modules that should print debug information.</p>
|
|
<h3><code>NODE_DEBUG_NATIVE=module[,…]</code><span><a class="mark" href="#cli_node_debug_native_module" id="cli_node_debug_native_module">#</a></span></h3>
|
|
<p><code>','</code>-separated list of core C++ modules that should print debug information.</p>
|
|
<h3><code>NODE_DISABLE_COLORS=1</code><span><a class="mark" href="#cli_node_disable_colors_1" id="cli_node_disable_colors_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.3.0</span>
|
|
</div>
|
|
<p>When set, colors will not be used in the REPL.</p>
|
|
<h3><code>NODE_EXTRA_CA_CERTS=file</code><span><a class="mark" href="#cli_node_extra_ca_certs_file" id="cli_node_extra_ca_certs_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.3.0</span>
|
|
</div>
|
|
<p>When set, the well known "root" CAs (like VeriSign) will be extended with the
|
|
extra certificates in <code>file</code>. The file should consist of one or more trusted
|
|
certificates in PEM format. A message will be emitted (once) with
|
|
<a href="process.html#process_process_emitwarning_warning_type_code_ctor"><code>process.emitWarning()</code></a> if the file is missing or
|
|
malformed, but any errors are otherwise ignored.</p>
|
|
<p>Neither the well known nor extra certificates are used when the <code>ca</code>
|
|
options property is explicitly specified for a TLS or HTTPS client or server.</p>
|
|
<p>This environment variable is ignored when <code>node</code> runs as setuid root or
|
|
has Linux file capabilities set.</p>
|
|
<h3><code>NODE_ICU_DATA=file</code><span><a class="mark" href="#cli_node_icu_data_file" id="cli_node_icu_data_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.11.15</span>
|
|
</div>
|
|
<p>Data path for ICU (<code>Intl</code> object) data. Will extend linked-in data when compiled
|
|
with small-icu support.</p>
|
|
<h3><code>NODE_NO_WARNINGS=1</code><span><a class="mark" href="#cli_node_no_warnings_1" id="cli_node_no_warnings_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.11.0</span>
|
|
</div>
|
|
<p>When set to <code>1</code>, process warnings are silenced.</p>
|
|
<h3><code>NODE_OPTIONS=options...</code><span><a class="mark" href="#cli_node_options_options" id="cli_node_options_options">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>A space-separated list of command line options. <code>options...</code> are interpreted
|
|
before command line options, so command line options will override or
|
|
compound after anything in <code>options...</code>. Node.js will exit with an error if
|
|
an option that is not allowed in the environment is used, such as <code>-p</code> or a
|
|
script file.</p>
|
|
<p>In case an option value happens to contain a space (for example a path listed
|
|
in <code>--require</code>), it must be escaped using double quotes. For example:</p>
|
|
<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./my path/file.js"'</span></code></pre>
|
|
<p>A singleton flag passed as a command line option will override the same flag
|
|
passed into <code>NODE_OPTIONS</code>:</p>
|
|
<pre><code class="language-bash"><span class="hljs-comment"># The inspector will be available on port 5555</span>
|
|
NODE_OPTIONS=<span class="hljs-string">'--inspect=localhost:4444'</span> node --inspect=localhost:5555</code></pre>
|
|
<p>A flag that can be passed multiple times will be treated as if its
|
|
<code>NODE_OPTIONS</code> instances were passed first, and then its command line
|
|
instances afterwards:</p>
|
|
<pre><code class="language-bash">NODE_OPTIONS=<span class="hljs-string">'--require "./a.js"'</span> node --require <span class="hljs-string">"./b.js"</span>
|
|
<span class="hljs-comment"># is equivalent to:</span>
|
|
node --require <span class="hljs-string">"./a.js"</span> --require <span class="hljs-string">"./b.js"</span></code></pre>
|
|
<p>Node.js options that are allowed are:</p>
|
|
<!-- node-options-node start -->
|
|
<ul>
|
|
<li><code>--conditions</code></li>
|
|
<li><code>--diagnostic-dir</code></li>
|
|
<li><code>--disable-proto</code></li>
|
|
<li><code>--enable-fips</code></li>
|
|
<li><code>--enable-source-maps</code></li>
|
|
<li><code>--experimental-import-meta-resolve</code></li>
|
|
<li><code>--experimental-json-modules</code></li>
|
|
<li><code>--experimental-loader</code></li>
|
|
<li><code>--experimental-modules</code></li>
|
|
<li><code>--experimental-policy</code></li>
|
|
<li><code>--experimental-repl-await</code></li>
|
|
<li><code>--experimental-specifier-resolution</code></li>
|
|
<li><code>--experimental-vm-modules</code></li>
|
|
<li><code>--experimental-wasi-unstable-preview1</code></li>
|
|
<li><code>--experimental-wasm-modules</code></li>
|
|
<li><code>--force-context-aware</code></li>
|
|
<li><code>--force-fips</code></li>
|
|
<li><code>--frozen-intrinsics</code></li>
|
|
<li><code>--heapsnapshot-signal</code></li>
|
|
<li><code>--http-parser</code></li>
|
|
<li><code>--http-server-default-timeout</code></li>
|
|
<li><code>--icu-data-dir</code></li>
|
|
<li><code>--input-type</code></li>
|
|
<li><code>--insecure-http-parser</code></li>
|
|
<li><code>--inspect-brk</code></li>
|
|
<li><code>--inspect-port</code>, <code>--debug-port</code></li>
|
|
<li><code>--inspect-publish-uid</code></li>
|
|
<li><code>--inspect</code></li>
|
|
<li><code>--max-http-header-size</code></li>
|
|
<li><code>--napi-modules</code></li>
|
|
<li><code>--no-deprecation</code></li>
|
|
<li><code>--no-force-async-hooks-checks</code></li>
|
|
<li><code>--no-warnings</code></li>
|
|
<li><code>--openssl-config</code></li>
|
|
<li><code>--pending-deprecation</code></li>
|
|
<li><code>--policy-integrity</code></li>
|
|
<li><code>--preserve-symlinks-main</code></li>
|
|
<li><code>--preserve-symlinks</code></li>
|
|
<li><code>--prof-process</code></li>
|
|
<li><code>--redirect-warnings</code></li>
|
|
<li><code>--report-compact</code></li>
|
|
<li><code>--report-dir</code>, <code>--report-directory</code></li>
|
|
<li><code>--report-filename</code></li>
|
|
<li><code>--report-on-fatalerror</code></li>
|
|
<li><code>--report-on-signal</code></li>
|
|
<li><code>--report-signal</code></li>
|
|
<li><code>--report-uncaught-exception</code></li>
|
|
<li><code>--require</code>, <code>-r</code></li>
|
|
<li><code>--throw-deprecation</code></li>
|
|
<li><code>--title</code></li>
|
|
<li><code>--tls-cipher-list</code></li>
|
|
<li><code>--tls-keylog</code></li>
|
|
<li><code>--tls-max-v1.2</code></li>
|
|
<li><code>--tls-max-v1.3</code></li>
|
|
<li><code>--tls-min-v1.0</code></li>
|
|
<li><code>--tls-min-v1.1</code></li>
|
|
<li><code>--tls-min-v1.2</code></li>
|
|
<li><code>--tls-min-v1.3</code></li>
|
|
<li><code>--trace-deprecation</code></li>
|
|
<li><code>--trace-event-categories</code></li>
|
|
<li><code>--trace-event-file-pattern</code></li>
|
|
<li><code>--trace-events-enabled</code></li>
|
|
<li><code>--trace-exit</code></li>
|
|
<li><code>--trace-sigint</code></li>
|
|
<li><code>--trace-sync-io</code></li>
|
|
<li><code>--trace-tls</code></li>
|
|
<li><code>--trace-uncaught</code></li>
|
|
<li><code>--trace-warnings</code></li>
|
|
<li><code>--track-heap-objects</code></li>
|
|
<li><code>--unhandled-rejections</code></li>
|
|
<li><code>--use-bundled-ca</code></li>
|
|
<li><code>--use-largepages</code></li>
|
|
<li><code>--use-openssl-ca</code></li>
|
|
<li><code>--v8-pool-size</code></li>
|
|
<li><code>--zero-fill-buffers</code>
|
|
<!-- node-options-node end -->
|
|
</li>
|
|
</ul>
|
|
<p>V8 options that are allowed are:</p>
|
|
<!-- node-options-v8 start -->
|
|
<ul>
|
|
<li><code>--abort-on-uncaught-exception</code></li>
|
|
<li><code>--disallow-code-generation-from-strings</code></li>
|
|
<li><code>--huge-max-old-generation-size</code></li>
|
|
<li><code>--interpreted-frames-native-stack</code></li>
|
|
<li><code>--jitless</code></li>
|
|
<li><code>--max-old-space-size</code></li>
|
|
<li><code>--perf-basic-prof-only-functions</code></li>
|
|
<li><code>--perf-basic-prof</code></li>
|
|
<li><code>--perf-prof-unwinding-info</code></li>
|
|
<li><code>--perf-prof</code></li>
|
|
<li><code>--stack-trace-limit</code>
|
|
<!-- node-options-v8 end -->
|
|
</li>
|
|
</ul>
|
|
<p><code>--perf-basic-prof-only-functions</code>, <code>--perf-basic-prof</code>,
|
|
<code>--perf-prof-unwinding-info</code>, and <code>--perf-prof</code> are only available on Linux.</p>
|
|
<h3><code>NODE_PATH=path[:…]</code><span><a class="mark" href="#cli_node_path_path" id="cli_node_path_path">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v0.1.32</span>
|
|
</div>
|
|
<p><code>':'</code>-separated list of directories prefixed to the module search path.</p>
|
|
<p>On Windows, this is a <code>';'</code>-separated list instead.</p>
|
|
<h3><code>NODE_PENDING_DEPRECATION=1</code><span><a class="mark" href="#cli_node_pending_deprecation_1" id="cli_node_pending_deprecation_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>When set to <code>1</code>, emit pending deprecation warnings.</p>
|
|
<p>Pending deprecations are generally identical to a runtime deprecation with the
|
|
notable exception that they are turned <em>off</em> by default and will not be emitted
|
|
unless either the <code>--pending-deprecation</code> command line flag, or the
|
|
<code>NODE_PENDING_DEPRECATION=1</code> environment variable, is set. Pending deprecations
|
|
are used to provide a kind of selective "early warning" mechanism that
|
|
developers may leverage to detect deprecated API usage.</p>
|
|
<h3><code>NODE_PENDING_PIPE_INSTANCES=instances</code><span><a class="mark" href="#cli_node_pending_pipe_instances_instances" id="cli_node_pending_pipe_instances_instances">#</a></span></h3>
|
|
<p>Set the number of pending pipe instance handles when the pipe server is waiting
|
|
for connections. This setting applies to Windows only.</p>
|
|
<h3><code>NODE_PRESERVE_SYMLINKS=1</code><span><a class="mark" href="#cli_node_preserve_symlinks_1" id="cli_node_preserve_symlinks_1">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.1.0</span>
|
|
</div>
|
|
<p>When set to <code>1</code>, instructs the module loader to preserve symbolic links when
|
|
resolving and caching modules.</p>
|
|
<h3><code>NODE_REDIRECT_WARNINGS=file</code><span><a class="mark" href="#cli_node_redirect_warnings_file" id="cli_node_redirect_warnings_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v8.0.0</span>
|
|
</div>
|
|
<p>When set, process warnings will be emitted to the given file instead of
|
|
printing to stderr. The file will be created if it does not exist, and will be
|
|
appended to if it does. If an error occurs while attempting to write the
|
|
warning to the file, the warning will be written to stderr instead. This is
|
|
equivalent to using the <code>--redirect-warnings=file</code> command-line flag.</p>
|
|
<h3><code>NODE_REPL_HISTORY=file</code><span><a class="mark" href="#cli_node_repl_history_file" id="cli_node_repl_history_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v3.0.0</span>
|
|
</div>
|
|
<p>Path to the file used to store the persistent REPL history. The default path is
|
|
<code>~/.node_repl_history</code>, which is overridden by this variable. Setting the value
|
|
to an empty string (<code>''</code> or <code>' '</code>) disables persistent REPL history.</p>
|
|
<h3><code>NODE_REPL_EXTERNAL_MODULE=file</code><span><a class="mark" href="#cli_node_repl_external_module_file" id="cli_node_repl_external_module_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v12.16.0</span>
|
|
</div>
|
|
<p>Path to a Node.js module which will be loaded in place of the built-in REPL.
|
|
Overriding this value to an empty string (<code>''</code>) will use the built-in REPL.</p>
|
|
<h3><code>NODE_TLS_REJECT_UNAUTHORIZED=value</code><span><a class="mark" href="#cli_node_tls_reject_unauthorized_value" id="cli_node_tls_reject_unauthorized_value">#</a></span></h3>
|
|
<p>If <code>value</code> equals <code>'0'</code>, certificate validation is disabled for TLS connections.
|
|
This makes TLS, and HTTPS by extension, insecure. The use of this environment
|
|
variable is strongly discouraged.</p>
|
|
<h3><code>NODE_V8_COVERAGE=dir</code><span><a class="mark" href="#cli_node_v8_coverage_dir" id="cli_node_v8_coverage_dir">#</a></span></h3>
|
|
<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
|
|
<a href="https://sourcemaps.info/spec.html">Source Map</a> data to the directory provided as an argument (coverage
|
|
information is written as JSON to files with a <code>coverage</code> prefix).</p>
|
|
<p><code>NODE_V8_COVERAGE</code> will automatically propagate to subprocesses, making it
|
|
easier to instrument applications that call the <code>child_process.spawn()</code> family
|
|
of functions. <code>NODE_V8_COVERAGE</code> can be set to an empty string, to prevent
|
|
propagation.</p>
|
|
<h4>Coverage output<span><a class="mark" href="#cli_coverage_output" id="cli_coverage_output">#</a></span></h4>
|
|
<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
|
|
key <code>result</code>:</p>
|
|
<pre><code class="language-json">{
|
|
<span class="hljs-attr">"result"</span>: [
|
|
{
|
|
<span class="hljs-attr">"scriptId"</span>: <span class="hljs-string">"67"</span>,
|
|
<span class="hljs-attr">"url"</span>: <span class="hljs-string">"internal/tty.js"</span>,
|
|
<span class="hljs-attr">"functions"</span>: []
|
|
}
|
|
]
|
|
}</code></pre>
|
|
<h4>Source map cache<span><a class="mark" href="#cli_source_map_cache" id="cli_source_map_cache">#</a></span></h4>
|
|
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#documentation_stability_index">Stability: 1</a> - Experimental</div><p></p>
|
|
<p>If found, source map data is appended to the top-level key <code>source-map-cache</code>
|
|
on the JSON coverage object.</p>
|
|
<p><code>source-map-cache</code> is an object with keys representing the files source maps
|
|
were extracted from, and values which include the raw source-map URL
|
|
(in the key <code>url</code>), the parsed Source Map v3 information (in the key <code>data</code>),
|
|
and the line lengths of the source file (in the key <code>lineLengths</code>).</p>
|
|
<pre><code class="language-json">{
|
|
<span class="hljs-attr">"result"</span>: [
|
|
{
|
|
<span class="hljs-attr">"scriptId"</span>: <span class="hljs-string">"68"</span>,
|
|
<span class="hljs-attr">"url"</span>: <span class="hljs-string">"file:///absolute/path/to/source.js"</span>,
|
|
<span class="hljs-attr">"functions"</span>: []
|
|
}
|
|
],
|
|
<span class="hljs-attr">"source-map-cache"</span>: {
|
|
<span class="hljs-attr">"file:///absolute/path/to/source.js"</span>: {
|
|
<span class="hljs-attr">"url"</span>: <span class="hljs-string">"./path-to-map.json"</span>,
|
|
<span class="hljs-attr">"data"</span>: {
|
|
<span class="hljs-attr">"version"</span>: <span class="hljs-number">3</span>,
|
|
<span class="hljs-attr">"sources"</span>: [
|
|
<span class="hljs-string">"file:///absolute/path/to/original.js"</span>
|
|
],
|
|
<span class="hljs-attr">"names"</span>: [
|
|
<span class="hljs-string">"Foo"</span>,
|
|
<span class="hljs-string">"console"</span>,
|
|
<span class="hljs-string">"info"</span>
|
|
],
|
|
<span class="hljs-attr">"mappings"</span>: <span class="hljs-string">"MAAMA,IACJC,YAAaC"</span>,
|
|
<span class="hljs-attr">"sourceRoot"</span>: <span class="hljs-string">"./"</span>
|
|
},
|
|
<span class="hljs-attr">"lineLengths"</span>: [
|
|
<span class="hljs-number">13</span>,
|
|
<span class="hljs-number">62</span>,
|
|
<span class="hljs-number">38</span>,
|
|
<span class="hljs-number">27</span>
|
|
]
|
|
}
|
|
}
|
|
}</code></pre>
|
|
<h3><code>OPENSSL_CONF=file</code><span><a class="mark" href="#cli_openssl_conf_file" id="cli_openssl_conf_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v6.11.0</span>
|
|
</div>
|
|
<p>Load an OpenSSL configuration file on startup. Among other uses, this can be
|
|
used to enable FIPS-compliant crypto if Node.js is built with <code>./configure --openssl-fips</code>.</p>
|
|
<p>If the <a href="#cli_openssl_config_file"><code>--openssl-config</code></a> command line option is used, the environment
|
|
variable is ignored.</p>
|
|
<h3><code>SSL_CERT_DIR=dir</code><span><a class="mark" href="#cli_ssl_cert_dir_dir" id="cli_ssl_cert_dir_dir">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.7.0</span>
|
|
</div>
|
|
<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's directory
|
|
containing trusted certificates.</p>
|
|
<p>Be aware that unless the child environment is explicitly set, this environment
|
|
variable will be inherited by any child processes, and if they use OpenSSL, it
|
|
may cause them to trust the same CAs as node.</p>
|
|
<h3><code>SSL_CERT_FILE=file</code><span><a class="mark" href="#cli_ssl_cert_file_file" id="cli_ssl_cert_file_file">#</a></span></h3>
|
|
<div class="api_metadata">
|
|
<span>Added in: v7.7.0</span>
|
|
</div>
|
|
<p>If <code>--use-openssl-ca</code> is enabled, this overrides and sets OpenSSL's file
|
|
containing trusted certificates.</p>
|
|
<p>Be aware that unless the child environment is explicitly set, this environment
|
|
variable will be inherited by any child processes, and if they use OpenSSL, it
|
|
may cause them to trust the same CAs as node.</p>
|
|
<h3><code>UV_THREADPOOL_SIZE=size</code><span><a class="mark" href="#cli_uv_threadpool_size_size" id="cli_uv_threadpool_size_size">#</a></span></h3>
|
|
<p>Set the number of threads used in libuv's threadpool to <code>size</code> threads.</p>
|
|
<p>Asynchronous system APIs are used by Node.js whenever possible, but where they
|
|
do not exist, libuv's threadpool is used to create asynchronous node APIs based
|
|
on synchronous system APIs. Node.js APIs that use the threadpool are:</p>
|
|
<ul>
|
|
<li>all <code>fs</code> APIs, other than the file watcher APIs and those that are explicitly
|
|
synchronous</li>
|
|
<li>asynchronous crypto APIs such as <code>crypto.pbkdf2()</code>, <code>crypto.scrypt()</code>,
|
|
<code>crypto.randomBytes()</code>, <code>crypto.randomFill()</code>, <code>crypto.generateKeyPair()</code></li>
|
|
<li><code>dns.lookup()</code></li>
|
|
<li>all <code>zlib</code> APIs, other than those that are explicitly synchronous</li>
|
|
</ul>
|
|
<p>Because libuv's threadpool has a fixed size, it means that if for whatever
|
|
reason any of these APIs takes a long time, other (seemingly unrelated) APIs
|
|
that run in libuv's threadpool will experience degraded performance. In order to
|
|
mitigate this issue, one potential solution is to increase the size of libuv's
|
|
threadpool by setting the <code>'UV_THREADPOOL_SIZE'</code> environment variable to a value
|
|
greater than <code>4</code> (its current default value). For more information, see the
|
|
<a href="https://docs.libuv.org/en/latest/threadpool.html">libuv threadpool documentation</a>.</p>
|
|
<h2>Useful V8 options<span><a class="mark" href="#cli_useful_v8_options" id="cli_useful_v8_options">#</a></span></h2>
|
|
<p>V8 has its own set of CLI options. Any V8 CLI option that is provided to <code>node</code>
|
|
will be passed on to V8 to handle. V8's options have <em>no stability guarantee</em>.
|
|
The V8 team themselves don't consider them to be part of their formal API,
|
|
and reserve the right to change them at any time. Likewise, they are not
|
|
covered by the Node.js stability guarantees. Many of the V8
|
|
options are of interest only to V8 developers. Despite this, there is a small
|
|
set of V8 options that are widely applicable to Node.js, and they are
|
|
documented here:</p>
|
|
<h3><code>--max-old-space-size=SIZE</code> (in megabytes)<span><a class="mark" href="#cli_max_old_space_size_size_in_megabytes" id="cli_max_old_space_size_size_in_megabytes">#</a></span></h3>
|
|
<p>Sets the max memory size of V8's old memory section. As memory
|
|
consumption approaches the limit, V8 will spend more time on
|
|
garbage collection in an effort to free unused memory.</p>
|
|
<p>On a machine with 2GB of memory, consider setting this to
|
|
1536 (1.5GB) to leave some memory for other uses and avoid swapping.</p>
|
|
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> node --max-old-space-size=1536 index.js</span></code></pre>
|
|
<!-- API END -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|