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

ENVIRONMENT

427     NODE_DEBUG modules...
428             Comma-separated list of core modules that should print debug in‐
429             formation.
430
431     NODE_DEBUG_NATIVE modules...
432             Comma-separated list of C++ core modules that should print debug
433             information.
434
435     NODE_DISABLE_COLORS
436             When set to 1, colors will not be used in the REPL.
437
438     NODE_EXTRA_CA_CERTS file
439             When set, the well-known “root” CAs (like VeriSign) will be ex‐
440             tended with the extra certificates in file.  The file should con‐
441             sist of one or more trusted certificates in PEM format.
442
443             If file is missing or misformatted, a message will be emitted
444             once using process.emitWarning(), but any errors are otherwise
445             ignored.
446
447             This environment variable is ignored when `node` runs as setuid
448             root or has Linux file capabilities set.
449
450             The NODE_EXTRA_CA_CERTS environment variable is only read when
451             the Node.js process is first launched.  Changing the value at
452             runtime using process.env.NODE_EXTRA_CA_CERTS has no effect on
453             the current process.
454
455     NODE_ICU_DATA file
456             Data path for ICU (Intl object) data.  Will extend linked-in data
457             when compiled with small-icu support.
458
459     NODE_NO_WARNINGS
460             When set to 1, process warnings are silenced.
461
462     NODE_OPTIONS options...
463             A space-separated list of command-line options, which are inter‐
464             preted as if they had been specified on the command line before
465             the actual command (so they can be overridden).  Node.js will
466             exit with an error if an option that is not allowed in the envi‐
467             ronment is used, such as --print or a script file.
468
469     NODE_PATH directories...
470             A colon-separated list of directories prefixed to the module
471             search path.
472
473     NODE_PENDING_DEPRECATION
474             When set to 1, emit pending deprecation warnings.
475
476     NODE_PRESERVE_SYMLINKS
477             When set to 1, the module loader preserves symbolic links when
478             resolving and caching modules.
479
480     NODE_REDIRECT_WARNINGS file
481             Write process warnings to the given file instead of printing to
482             stderr.  Equivalent to passing --redirect-warnings file on the
483             command line.
484
485     NODE_REPL_HISTORY file
486             Path to the file used to store persistent REPL history.  The de‐
487             fault path is ~/.node_repl_history, which is overridden by this
488             variable.  Setting the value to an empty string ("" or " ") will
489             disable persistent REPL history.
490
491     NODE_SKIP_PLATFORM_CHECK
492             When set to 1, the check for a supported platform is skipped dur‐
493             ing Node.js startup.  Node.js might not execute correctly.  Any
494             issues encountered on unsupported platforms will not be fixed.
495
496     NODE_TLS_REJECT_UNAUTHORIZED
497             When set to 0, TLS certificate validation is disabled.
498
499     NODE_V8_COVERAGE dir
500             When set, Node.js writes JavaScript code coverage information to
501             dir.
502
503     OPENSSL_CONF file
504             Load an OpenSSL configuration file on startup.  Among other uses,
505             this can be used to enable FIPS-compliant crypto if Node.js is
506             built with ./configure --openssl-fips.
507
508             If the --openssl-config command-line option is used, this envi‐
509             ronment variable is ignored.
510
511     SSL_CERT_DIR dir
512             If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
513             directory containing trusted certificates.
514
515     SSL_CERT_FILE file
516             If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
517             file containing trusted certificates.
518
519     UV_THREADPOOL_SIZE size
520             Sets the number of threads used in libuv's threadpool to size.
521

BUGS

523     Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
524
526     Copyright Node.js contributors.  Node.js is available under the MIT li‐
527     cense.
528
529     Node.js also includes external libraries that are available under a vari‐
530     ety of licenses.  See https://github.com/nodejs/node/blob/master/LICENSE
531     for the full license text.
532

SEE ALSO

534     Website: https://nodejs.org/
535
536     Documentation: https://nodejs.org/api/
537
538     GitHub repository & Issue Tracker: https://github.com/nodejs/node
539
540     IRC (general questions): chat.freenode.net #node.js (unofficial)
541
542     IRC (Node.js core development): chat.freenode.net #node-dev
543

AUTHORS

545     Written and maintained by 1000+ contributors:
546     https://github.com/nodejs/node/blob/master/AUTHORS
547
548                                 June 15, 2021
Impressum