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

ENVIRONMENT

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

BUGS

560     Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
561
563     Copyright Node.js contributors.  Node.js is available under the MIT li‐
564     cense.
565
566     Node.js also includes external libraries that are available under a vari‐
567     ety of licenses.  See https://github.com/nodejs/node/blob/HEAD/LICENSE
568     for the full license text.
569

SEE ALSO

571     Website: https://nodejs.org/
572
573     Documentation: https://nodejs.org/api/
574
575     GitHub repository and issue tracker: https://github.com/nodejs/node
576
577     IRC (general questions): libera.chat #node.js (unofficial)
578

AUTHORS

580     Written and maintained by 1000+ contributors:
581     https://github.com/nodejs/node/blob/HEAD/AUTHORS
582
583                               December 5, 2021
Impressum