1NODE(1)                   BSD General Commands Manual                  NODE(1)
2

NAME

4     node — server-side JavaScript runtime
5

SYNOPSIS

7     node [options] [v8-options] [-e string | script.js | -] [--]
8          [arguments ...]
9     node inspect [-e string | script.js | - | <host>:<port>] ...
10     node [--v8-options]
11

DESCRIPTION

13     Node.js is a set of libraries for JavaScript which allows it to be used
14     outside of the browser.  It is primarily focused on creating simple,
15     easy-to-build network clients and servers.
16
17     Execute node without arguments to start a REPL.
18

OPTIONS

20     -       Alias for stdin, analogous to the use of - in other command-line
21             utilities.  The executed script is read from stdin, and remaining
22             arguments are passed to the script.
23
24     --      Indicate the end of command-line options.  Pass the rest of the
25             arguments to the script.
26
27             If no script filename or eval/print script is supplied prior to
28             this, then the next argument will be used as a script filename.
29
30     --abort-on-uncaught-exception
31             Aborting instead of exiting causes a core file to be generated
32             for analysis.
33
34     --completion-bash
35             Print source-able bash completion script for Node.js.
36
37     -C, --conditions string
38             Use custom conditional exports conditions.  string
39
40     --cpu-prof
41             Start the V8 CPU profiler on start up, and write the CPU profile
42             to disk before exit. If --cpu-prof-dir is not specified, the pro‐
43             file will be written to the current working directory with a gen‐
44             erated file name.
45
46     --cpu-prof-dir
47             The directory where the CPU profiles generated by --cpu-prof will
48             be placed.  The default value is controlled by the
49             --diagnostic-dir.  command-line option.
50
51     --cpu-prof-interval
52             The sampling interval in microseconds for the CPU profiles gener‐
53             ated by --cpu-prof.  The default is 1000.
54
55     --cpu-prof-name
56             File name of the V8 CPU profile generated with --cpu-prof.
57
58     --diagnostic-dir
59             Set the directory for all diagnostic output files.  Default is
60             current working directory.  Set the directory to which all diag‐
61             nostic output files will be written to.  Defaults to current
62             working directory.  Affects the default output directory of:
63             --cpu-prof-dir.  --heap-prof-dir.  --redirect-warnings.
64
65     --disable-proto=mode
66             Disable the `Object.prototype.__proto__` property. If mode is
67             `delete`, the property will be removed entirely. If mode is
68             `throw`, accesses to the property will throw an exception with
69             the code `ERR_PROTO_ACCESS`.
70
71     --disallow-code-generation-from-strings
72             Make built-in language features like `eval` and `new Function`
73             that generate code from strings throw an exception instead. This
74             does not affect the Node.js `vm` module.
75
76     --enable-fips
77             Enable FIPS-compliant crypto at startup.  Requires Node.js to be
78             built with ./configure --openssl-fips.
79
80     --enable-source-maps
81             Enable Source Map V3 support for stack traces.
82
83     --experimental-global-customevent
84             Expose the CustomEvent on the global scope.
85
86     --experimental-global-webcrypto
87             Expose the Web Crypto API on the global scope.
88
89     --experimental-import-meta-resolve
90             Enable experimental ES modules support for import.meta.resolve().
91
92     --experimental-loader=module
93             Specify the module to use as a custom module loader.
94
95     --experimental-network-imports
96             Enable experimental support for loading modules using `import`
97             over `https:`.
98
99     --experimental-policy
100             Use the specified file as a security policy.
101
102     --no-experimental-fetch
103             Disable experimental support for the Fetch API.
104
105     --no-experimental-repl-await
106             Disable top-level await keyword support in REPL.
107
108     --experimental-specifier-resolution
109             Select extension resolution algorithm for ES Modules; either 'ex‐
110             plicit' (default) or 'node'.
111
112     --experimental-vm-modules
113             Enable experimental ES module support in VM module.
114
115     --experimental-wasi-unstable-preview1
116             Enable experimental WebAssembly System Interface support.
117
118     --experimental-wasm-modules
119             Enable experimental WebAssembly module support.
120
121     --force-context-aware
122             Disable loading native addons that are not context-aware.
123
124     --force-fips
125             Force FIPS-compliant crypto on startup (Cannot be disabled from
126             script code).  Same requirements as --enable-fips.
127
128     --frozen-intrinsics
129             Enable experimental frozen intrinsics support.
130
131     --heapsnapshot-near-heap-limit=max_count
132             Generate heap snapshot when the V8 heap usage is approaching the
133             heap limit.  No more than the specified number of snapshots will
134             be generated.
135
136     --heapsnapshot-signal=signal
137             Generate heap snapshot on specified signal.
138
139     --heap-prof
140             Start the V8 heap profiler on start up, and write the heap pro‐
141             file to disk before exit. If --heap-prof-dir is not specified,
142             the profile will be written to the current working directory with
143             a generated file name.
144
145     --heap-prof-dir
146             The directory where the heap profiles generated by --heap-prof
147             will be placed.  The default value is controlled by the
148             --diagnostic-dir.  command-line option.
149
150     --heap-prof-interval
151             The average sampling interval in bytes for the heap profiles gen‐
152             erated by --heap-prof.  The default is 512 * 1024.
153
154     --heap-prof-name
155             File name of the V8 heap profile generated with --heap-prof.
156
157     --icu-data-dir=file
158             Specify ICU data load path.  Overrides NODE_ICU_DATA.
159
160     --input-type=type
161             Set the module resolution type for input via --eval, --print or
162             STDIN.
163
164     --inspect-brk=[host:]port
165             Activate inspector on host:port and break at start of user
166             script.
167
168     --inspect-port=[host:]port
169             Set the host:port to be used when the inspector is activated.
170
171     --inspect-publish-uid=stderr,http
172             Specify how the inspector WebSocket URL is exposed.  Valid values
173             are stderr and http.  Default is stderr,http.
174
175     --inspect=[host:]port
176             Activate inspector on host:port.  Default is 127.0.0.1:9229.
177
178             V8 Inspector integration allows attaching Chrome DevTools and
179             IDEs to Node.js instances for debugging and profiling.  It uses
180             the Chrome DevTools Protocol.
181
182     --insecure-http-parser
183             Use an insecure HTTP parser that accepts invalid HTTP headers.
184             This may allow interoperability with non-conformant HTTP imple‐
185             mentations. It may also allow request smuggling and other HTTP
186             attacks that rely on invalid headers being accepted. Avoid using
187             this option.
188
189     --jitless
190             Disable runtime allocation of executable memory. This may be re‐
191             quired on some platforms for security reasons. It can also reduce
192             attack surface on other platforms, but the performance impact may
193             be severe.
194
195             This flag is inherited from V8 and is subject to change upstream.
196             It may disappear in a non-semver-major release.
197
198     --max-http-header-size=size
199             Specify the maximum size of HTTP headers in bytes. Defaults to 16
200             KiB.
201
202     --napi-modules
203             This option is a no-op.  It is kept for compatibility.
204
205     --no-deprecation
206             Silence deprecation warnings.
207
208     --no-extra-info-on-fatal-exception
209             Hide extra information on fatal exception that causes exit.
210
211     --no-force-async-hooks-checks
212             Disable runtime checks for `async_hooks`.  These will still be
213             enabled dynamically when `async_hooks` is enabled.
214
215     --no-addons
216             Disable the `node-addons` exports condition as well as disable
217             loading native addons. When `--no-addons` is specified, calling
218             `process.dlopen` or requiring a native C++ addon will fail and
219             throw an exception.
220
221     --no-global-search-paths
222             Do not search modules from global paths.
223
224     --no-warnings
225             Silence all process warnings (including deprecations).
226
227     --node-memory-debug
228             Enable extra debug checks for memory leaks in Node.js internals.
229             This is usually only useful for developers debugging Node.js it‐
230             self.
231
232     --openssl-config=file
233             Load an OpenSSL configuration file on startup.  Among other uses,
234             this can be used to enable FIPS-compliant crypto if Node.js is
235             built with ./configure --openssl-fips.
236
237     --pending-deprecation
238             Emit pending deprecation warnings.
239
240     --policy-integrity=sri
241             Instructs Node.js to error prior to running any code if the pol‐
242             icy does not have the specified integrity. It expects a Subre‐
243             source Integrity string as a parameter.
244
245     --preserve-symlinks
246             Instructs the module loader to preserve symbolic links when re‐
247             solving and caching modules other than the main module.
248
249     --preserve-symlinks-main
250             Instructs the module loader to preserve symbolic links when re‐
251             solving and caching the main module.
252
253     --prof  Generate V8 profiler output.
254
255     --prof-process
256             Process V8 profiler output generated using the V8 option --prof.
257
258     --redirect-warnings=file
259             Write process warnings to the given file instead of printing to
260             stderr.
261
262     --report-compact
263             Write diagnostic reports in a compact format, single-line JSON.
264
265     --report-dir --report-directory
266             Location at which the diagnostic report will be generated.  The
267             `file` name may be an absolute path. If it is not, the default
268             directory it will be written to is controlled by the
269             --diagnostic-dir.  command-line option.
270
271     --report-filename
272             Name of the file to which the diagnostic report will be written.
273
274     --report-on-fatalerror
275             Enables the diagnostic report to be triggered on fatal errors
276             (internal errors within the Node.js runtime such as out of mem‐
277             ory) that leads to termination of the application. Useful to in‐
278             spect various diagnostic data elements such as heap, stack, event
279             loop state, resource consumption etc. to reason about the fatal
280             error.
281
282     --report-on-signal
283             Enables diagnostic report to be generated upon receiving the
284             specified (or predefined) signal to the running Node.js process.
285             Default signal is SIGUSR2.
286
287     --report-signal
288             Sets or resets the signal for diagnostic report generation (not
289             supported on Windows). Default signal is SIGUSR2.
290
291     --report-uncaught-exception
292             Enables diagnostic report to be generated on un-caught excep‐
293             tions. Useful when inspecting JavaScript stack in conjunction
294             with native stack and other runtime environment data.
295
296     --secure-heap=n
297             Specify the size of the OpenSSL secure heap. Any value less than
298             2 disables the secure heap. The default is 0. The value must be a
299             power of two.
300
301     --secure-heap-min=n
302             Specify the minimum allocation from the OpenSSL secure heap. The
303             default is 2. The value must be a power of two.
304
305     --test  Starts the Node.js command line test runner.
306
307     --test-name-pattern
308             A regular expression that configures the test runner to only exe‐
309             cute tests whose name matches the provided pattern.
310
311     --test-only
312             Configures the test runner to only execute top level tests that
313             have the `only` option set.
314
315     --throw-deprecation
316             Throw errors for deprecations.
317
318     --title=title
319             Specify process.title on startup.
320
321     --tls-cipher-list=list
322             Specify an alternative default TLS cipher list.  Requires Node.js
323             to be built with crypto support. (Default)
324
325     --tls-keylog=file
326             Log TLS key material to a file. The key material is in NSS SS‐
327             LKEYLOGFILE format and can be used by software (such as Wire‐
328             shark) to decrypt the TLS traffic.
329
330     --tls-max-v1.2
331             Set default  maxVersion to 'TLSv1.2'. Use to disable support for
332             TLSv1.3.
333
334     --tls-max-v1.3
335             Set default  maxVersion to 'TLSv1.3'. Use to enable support for
336             TLSv1.3.
337
338     --tls-min-v1.0
339             Set default minVersion to 'TLSv1'. Use for compatibility with old
340             TLS clients or servers.
341
342     --tls-min-v1.1
343             Set default minVersion to 'TLSv1.1'. Use for compatibility with
344             old TLS clients or servers.
345
346     --tls-min-v1.2
347             Set default minVersion to 'TLSv1.2'. This is the default for 12.x
348             and later, but the option is supported for compatibility with
349             older Node.js versions.
350
351     --tls-min-v1.3
352             Set default minVersion to 'TLSv1.3'. Use to disable support for
353             TLSv1.2 in favour of TLSv1.3, which is more secure.
354
355     --trace-atomics-wait
356             Print short summaries of calls to Atomics.wait().  This flag is
357             deprecated.
358
359     --trace-deprecation
360             Print stack traces for deprecations.
361
362     --trace-event-categories categories
363             A comma-separated list of categories that should be traced when
364             trace event tracing is enabled using --trace-events-enabled.
365
366     --trace-event-file-pattern pattern
367             Template string specifying the filepath for the trace event data,
368             it supports ${rotation} and ${pid}.
369
370     --trace-events-enabled
371             Enable the collection of trace event tracing information.
372
373     --trace-exit
374             Prints a stack trace whenever an environment is exited proac‐
375             tively, i.e. invoking `process.exit()`.
376
377     --trace-sigint
378             Prints a stack trace on SIGINT.
379
380     --trace-sync-io
381             Print a stack trace whenever synchronous I/O is detected after
382             the first turn of the event loop.
383
384     --trace-tls
385             Prints TLS packet trace information to stderr.
386
387     --trace-uncaught
388             Print stack traces for uncaught exceptions; usually, the stack
389             trace associated with the creation of an Error is printed,
390             whereas this makes Node.js also print the stack trace associated
391             with throwing the value (which does not need to be an Error in‐
392             stance).
393
394             Enabling this option may affect garbage collection behavior nega‐
395             tively.
396
397     --trace-warnings
398             Print stack traces for process warnings (including deprecations).
399
400     --track-heap-objects
401             Track heap object allocations for heap snapshots.
402
403     --unhandled-rejections=mode
404             Define the behavior for unhandled rejections. Can be one of
405             `strict` (raise an error), `warn` (enforce warnings) or `none`
406             (silence warnings).
407
408     --update-assert-snapshot
409             Updates snapshot files used by `assert.snapshot()`.
410
411     --use-bundled-ca, --use-openssl-ca
412             Use bundled Mozilla CA store as supplied by current Node.js ver‐
413             sion or use OpenSSL's default CA store.  The default store is se‐
414             lectable at build-time.
415
416             The bundled CA store, as supplied by Node.js, is a snapshot of
417             Mozilla CA store that is fixed at release time.  It is identical
418             on all supported platforms.
419
420             Using OpenSSL store allows for external modifications of the
421             store.  For most Linux and BSD distributions, this store is main‐
422             tained by the distribution maintainers and system administrators.
423             OpenSSL CA store location is dependent on configuration of the
424             OpenSSL library but this can be altered at runtime using environ‐
425             ment variables.
426
427             See SSL_CERT_DIR and SSL_CERT_FILE.
428
429     --use-largepages=mode
430             Re-map the Node.js static code to large memory pages at startup.
431             If supported on the target system, this will cause the Node.js
432             static code to be moved onto 2 MiB pages instead of 4 KiB pages.
433
434             mode must have one of the following values: `off` (the default
435             value, meaning do not map), `on` (map and ignore failure, report‐
436             ing it to stderr), or `silent` (map and silently ignore failure).
437
438     --v8-options
439             Print V8 command-line options.
440
441     --v8-pool-size=num
442             Set V8's thread pool size which will be used to allocate back‐
443             ground jobs.  If set to 0 then V8 will choose an appropriate size
444             of the thread pool based on the number of online processors.  If
445             the value provided is larger than V8's maximum, then the largest
446             value will be chosen.
447
448     --zero-fill-buffers
449             Automatically zero-fills all newly allocated Buffer and Slow‐
450             Buffer instances.
451
452     -c, --check
453             Check the script's syntax without executing it.  Exits with an
454             error code if script is invalid.
455
456     -e, --eval string
457             Evaluate string as JavaScript.
458
459     -h, --help
460             Print command-line options.  The output of this option is less
461             detailed than this document.
462
463     -i, --interactive
464             Open the REPL even if stdin does not appear to be a terminal.
465
466     -p, --print string
467             Identical to -e, but prints the result.
468
469     -r, --require module
470             Preload the specified module at startup.  Follows `require()`'s
471             module resolution rules.  module may be either a path to a file,
472             or a Node.js module name.
473
474     -v, --version
475             Print node's version.
476

ENVIRONMENT

478     FORCE_COLOR
479             Used to enable ANSI colorized output. The value may be one of: 1
480             , true , or an empty string to indicate 16-color support, 2 to
481             indicate 256-color support, or 3 to indicate 16 million-color
482             support. When used and set to a supported value, both the
483             NO_COLOR and NODE_DISABLE_COLORS environment variables are ig‐
484             nored. Any other value will result in colorized output being dis‐
485             abled.
486
487     NO_COLOR
488             Alias for NODE_DISABLE_COLORS
489
490     NODE_DEBUG modules...
491             Comma-separated list of core modules that should print debug in‐
492             formation.
493
494     NODE_DEBUG_NATIVE modules...
495             Comma-separated list of C++ core modules that should print debug
496             information.
497
498     NODE_DISABLE_COLORS
499             When set to 1, colors will not be used in the REPL.
500
501     NODE_EXTRA_CA_CERTS file
502             When set, the well-known “root” CAs (like VeriSign) will be ex‐
503             tended with the extra certificates in file.  The file should con‐
504             sist of one or more trusted certificates in PEM format.
505
506             If file is missing or misformatted, a message will be emitted
507             once using process.emitWarning(), but any errors are otherwise
508             ignored.
509
510             This environment variable is ignored when `node` runs as setuid
511             root or has Linux file capabilities set.
512
513             The NODE_EXTRA_CA_CERTS environment variable is only read when
514             the Node.js process is first launched.  Changing the value at
515             runtime using process.env.NODE_EXTRA_CA_CERTS has no effect on
516             the current process.
517
518     NODE_ICU_DATA file
519             Data path for ICU (Intl object) data.  Will extend linked-in data
520             when compiled with small-icu support.
521
522     NODE_NO_WARNINGS
523             When set to 1, process warnings are silenced.
524
525     NODE_OPTIONS options...
526             A space-separated list of command-line options, which are inter‐
527             preted as if they had been specified on the command line before
528             the actual command (so they can be overridden).  Node.js will
529             exit with an error if an option that is not allowed in the envi‐
530             ronment is used, such as --print or a script file.
531
532     NODE_PATH directories...
533             A colon-separated list of directories prefixed to the module
534             search path.
535
536     NODE_PENDING_DEPRECATION
537             When set to 1, emit pending deprecation warnings.
538
539     NODE_PRESERVE_SYMLINKS
540             When set to 1, the module loader preserves symbolic links when
541             resolving and caching modules.
542
543     NODE_REDIRECT_WARNINGS file
544             Write process warnings to the given file instead of printing to
545             stderr.  Equivalent to passing --redirect-warnings file on the
546             command line.
547
548     NODE_REPL_HISTORY file
549             Path to the file used to store persistent REPL history.  The de‐
550             fault path is ~/.node_repl_history, which is overridden by this
551             variable.  Setting the value to an empty string ("" or " ") will
552             disable persistent REPL history.
553
554     NODE_REPL_EXTERNAL_MODULE file
555             Path to a Node.js module which will be loaded in place of the
556             built-in REPL.  Overriding this value to an empty string (`''`)
557             will use the built-in REPL.
558
559     NODE_SKIP_PLATFORM_CHECK
560             When set to 1, the check for a supported platform is skipped dur‐
561             ing Node.js startup.  Node.js might not execute correctly.  Any
562             issues encountered on unsupported platforms will not be fixed.
563
564     NODE_TLS_REJECT_UNAUTHORIZED
565             When set to 0, TLS certificate validation is disabled.
566
567     NODE_V8_COVERAGE dir
568             When set, Node.js writes JavaScript code coverage information to
569             dir.
570
571     OPENSSL_CONF file
572             Load an OpenSSL configuration file on startup.  Among other uses,
573             this can be used to enable FIPS-compliant crypto if Node.js is
574             built with ./configure --openssl-fips.
575
576             If the --openssl-config command-line option is used, this envi‐
577             ronment variable is ignored.
578
579     SSL_CERT_DIR dir
580             If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
581             directory containing trusted certificates.
582
583     SSL_CERT_FILE file
584             If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
585             file containing trusted certificates.
586
587     TZ      Specify the timezone configuration.
588
589     UV_THREADPOOL_SIZE size
590             Sets the number of threads used in libuv's threadpool to size.
591

BUGS

593     Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
594
596     Copyright Node.js contributors.  Node.js is available under the MIT li‐
597     cense.
598
599     Node.js also includes external libraries that are available under a vari‐
600     ety of licenses.  See https://github.com/nodejs/node/blob/HEAD/LICENSE
601     for the full license text.
602

SEE ALSO

604     Website: https://nodejs.org/
605
606     Documentation: https://nodejs.org/api/
607
608     GitHub repository and issue tracker: https://github.com/nodejs/node
609
610     IRC (general questions): libera.chat #node.js (unofficial)
611

AUTHORS

613     Written and maintained by 1000+ contributors:
614     https://github.com/nodejs/node/blob/HEAD/AUTHORS
615
616                               February 6, 2023
Impressum