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

ENVIRONMENT

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

BUGS

515     Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
516
518     Copyright Node.js contributors.  Node.js is available under the MIT
519     license.
520
521     Node.js also includes external libraries that are available under a vari‐
522     ety of licenses.  See https://github.com/nodejs/node/blob/master/LICENSE
523     for the full license text.
524

SEE ALSO

526     Website: https://nodejs.org/
527
528     Documentation: https://nodejs.org/api/
529
530     GitHub repository & Issue Tracker: https://github.com/nodejs/node
531
532     IRC (general questions): chat.freenode.net #node.js (unofficial)
533
534     IRC (Node.js core development): chat.freenode.net #node-dev
535

AUTHORS

537     Written and maintained by 1000+ contributors:
538     https://github.com/nodejs/node/blob/master/AUTHORS
539
540                                April 11, 2021
Impressum