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

ENVIRONMENT

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

BUGS

631     Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
632
634     Copyright Node.js contributors.  Node.js is available under the MIT li‐
635     cense.
636
637     Node.js also includes external libraries that are available under a vari‐
638     ety of licenses.  See https://github.com/nodejs/node/blob/HEAD/LICENSE
639     for the full license text.
640

SEE ALSO

642     Website: https://nodejs.org/
643
644     Documentation: https://nodejs.org/api/
645
646     GitHub repository and issue tracker: https://github.com/nodejs/node
647
648     IRC (general questions): libera.chat #node.js (unofficial)
649

AUTHORS

651     Written and maintained by 1000+ contributors:
652     https://github.com/nodejs/node/blob/HEAD/AUTHORS
653
654                               December 20, 2023
Impressum