1NODE(1) BSD General Commands Manual NODE(1)
2
4 node — server-side JavaScript runtime
5
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
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
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 --cpu-prof
38 Start the V8 CPU profiler on start up, and write the CPU profile
39 to disk before exit. If --cpu-prof-dir is not specified, the pro‐
40 file will be written to the current working directory with a gen‐
41 erated file name.
42
43 --cpu-prof-dir
44 The directory where the CPU profiles generated by --cpu-prof will
45 be placed.
46
47 --cpu-prof-interval
48 The sampling interval in microseconds for the CPU profiles gener‐
49 ated by --cpu-prof. The default is 1000.
50
51 --cpu-prof-name
52 File name of the V8 CPU profile generated with --cpu-prof
53
54 --enable-fips
55 Enable FIPS-compliant crypto at startup. Requires Node.js to be
56 built with ./configure --openssl-fips.
57
58 --es-module-specifier-resolution
59 Select extension resolution algorithm for ES Modules; either
60 'explicit' (default) or 'node'
61
62 --experimental-json-modules
63 Enable experimental JSON interop support for the ES Module
64 loader.
65
66 --experimental-modules
67 Enable experimental ES module support and caching modules.
68
69 --experimental-policy
70 Use the specified file as a security policy.
71
72 --experimental-repl-await
73 Enable experimental top-level await keyword support in REPL.
74
75 --experimental-report
76 Enable experimental diagnostic report feature.
77
78 --experimental-vm-modules
79 Enable experimental ES module support in VM module.
80
81 --experimental-wasm-modules
82 Enable experimental WebAssembly module support.
83
84 --force-fips
85 Force FIPS-compliant crypto on startup (Cannot be disabled from
86 script code). Same requirements as --enable-fips.
87
88 --frozen-intrinsics
89 Enable experimental frozen intrinsics support.
90
91 --heapsnapshot-signal=signal
92 Generate heap snapshot on specified signal.
93
94 --heap-prof
95 Start the V8 heap profiler on start up, and write the heap pro‐
96 file to disk before exit. If --heap-prof-dir is not specified,
97 the profile will be written to the current working directory with
98 a generated file name.
99
100 --heap-prof-dir
101 The directory where the heap profiles generated by --heap-prof
102 will be placed.
103
104 --heap-prof-interval
105 The average sampling interval in bytes for the heap profiles gen‐
106 erated by --heap-prof. The default is 512 * 1024.
107
108 --heap-prof-name
109 File name of the V8 heap profile generated with --heap-prof
110
111 --http-parser=library
112 Chooses an HTTP parser library. Available values are llhttp or
113 legacy.
114
115 --http-server-default-timeout=milliseconds
116 Overrides the default value for server socket timeout.
117
118 --icu-data-dir=file
119 Specify ICU data load path. Overrides NODE_ICU_DATA.
120
121 --input-type=type
122 Set the module resolution type for input via --eval, --print or
123 STDIN.
124
125 --inspect-brk=[host:]port
126 Activate inspector on host:port and break at start of user
127 script.
128
129 --inspect-port=[host:]port
130 Set the host:port to be used when the inspector is activated.
131
132 --inspect=[host:]port
133 Activate inspector on host:port. Default is 127.0.0.1:9229.
134
135 V8 Inspector integration allows attaching Chrome DevTools and
136 IDEs to Node.js instances for debugging and profiling. It uses
137 the Chrome DevTools Protocol.
138
139 --experimental-loader=module
140 Specify the module as a custom loader, to load
141 --experimental-modules.
142
143 --max-http-header-size=size
144 Specify the maximum size of HTTP headers in bytes. Defaults to
145 8KB.
146
147 --napi-modules
148 This option is a no-op. It is kept for compatibility.
149
150 --no-deprecation
151 Silence deprecation warnings.
152
153 --no-force-async-hooks-checks
154 Disable runtime checks for `async_hooks`. These will still be
155 enabled dynamically when `async_hooks` is enabled.
156
157 --no-warnings
158 Silence all process warnings (including deprecations).
159
160 --openssl-config=file
161 Load an OpenSSL configuration file on startup. Among other uses,
162 this can be used to enable FIPS-compliant crypto if Node.js is
163 built with ./configure --openssl-fips.
164
165 --pending-deprecation
166 Emit pending deprecation warnings.
167
168 --policy-integrity=sri
169 Instructs Node.js to error prior to running any code if the pol‐
170 icy does not have the specified integrity. It expects a Subre‐
171 source Integrity string as a parameter.
172
173 --preserve-symlinks
174 Instructs the module loader to preserve symbolic links when
175 resolving and caching modules other than the main module.
176
177 --preserve-symlinks-main
178 Instructs the module loader to preserve symbolic links when
179 resolving and caching the main module.
180
181 --prof Generate V8 profiler output.
182
183 --prof-process
184 Process V8 profiler output generated using the V8 option --prof.
185
186 --redirect-warnings=file
187 Write process warnings to the given file instead of printing to
188 stderr.
189
190 --report-directory
191 Location at which the diagnostic report will be generated.
192
193 --report-filename
194 Name of the file to which the diagnostic report will be written.
195
196 --report-on-fatalerror
197 Enables the diagnostic report to be triggered on fatal errors
198 (internal errors within the Node.js runtime such as out of mem‐
199 ory) that leads to termination of the application, if
200 --experimental-report is enabled. Useful to inspect various diag‐
201 nostic data elements such as heap, stack, event loop state,
202 resource consumption etc. to reason about the fatal error.
203
204 --report-on-signal
205 Enables diagnostic report to be generated upon receiving the
206 specified (or predefined) signal to the running Node.js process,
207 if --experimental-report is enabled. Default signal is SIGUSR2.
208
209 --report-signal
210 Sets or resets the signal for diagnostic report generation (not
211 supported on Windows). Default signal is SIGUSR2.
212
213 --report-uncaught-exception
214 Enables diagnostic report to be generated on un-caught excep‐
215 tions, if --experimental-report is enabled. Useful when inspect‐
216 ing JavaScript stack in conjunction with native stack and other
217 runtime environment data.
218
219 --throw-deprecation
220 Throw errors for deprecations.
221
222 --title=title
223 Specify process.title on startup.
224
225 --tls-cipher-list=list
226 Specify an alternative default TLS cipher list. Requires Node.js
227 to be built with crypto support. (Default)
228
229 --tls-max-v1.2
230 Set default maxVersion to 'TLSv1.2'. Use to disable support for
231 TLSv1.3.
232
233 --tls-max-v1.3
234 Set default maxVersion to 'TLSv1.3'. Use to enable support for
235 TLSv1.3.
236
237 --tls-min-v1.0
238 Set default minVersion to 'TLSv1'. Use for compatibility with old
239 TLS clients or servers.
240
241 --tls-min-v1.1
242 Set default minVersion to 'TLSv1.1'. Use for compatibility with
243 old TLS clients or servers.
244
245 --tls-min-v1.2
246 Set default minVersion to 'TLSv1.2'. This is the default for 12.x
247 and later, but the option is supported for compatibility with
248 older Node.js versions.
249
250 --tls-min-v1.3
251 Set default minVersion to 'TLSv1.3'. Use to disable support for
252 TLSv1.2 in favour of TLSv1.3, which is more secure.
253
254 --trace-deprecation
255 Print stack traces for deprecations.
256
257 --trace-event-categories categories
258 A comma-separated list of categories that should be traced when
259 trace event tracing is enabled using --trace-events-enabled.
260
261 --trace-event-file-pattern pattern
262 Template string specifying the filepath for the trace event data,
263 it supports ${rotation} and ${pid}.
264
265 --trace-events-enabled
266 Enable the collection of trace event tracing information.
267
268 --trace-sync-io
269 Print a stack trace whenever synchronous I/O is detected after
270 the first turn of the event loop.
271
272 --trace-tls
273 Prints TLS packet trace information to stderr.
274
275 --trace-warnings
276 Print stack traces for process warnings (including deprecations).
277
278 --track-heap-objects
279 Track heap object allocations for heap snapshots.
280
281 ---unhandled-rejections=mode
282 Define the behavior for unhandled rejections. Can be one of
283 `strict` (raise an error), `warn` (enforce warnings) or `none`
284 (silence warnings).
285
286 --use-bundled-ca, --use-openssl-ca
287 Use bundled Mozilla CA store as supplied by current Node.js ver‐
288 sion or use OpenSSL's default CA store. The default store is
289 selectable at build-time.
290
291 The bundled CA store, as supplied by Node.js, is a snapshot of
292 Mozilla CA store that is fixed at release time. It is identical
293 on all supported platforms.
294
295 Using OpenSSL store allows for external modifications of the
296 store. For most Linux and BSD distributions, this store is main‐
297 tained by the distribution maintainers and system administrators.
298 OpenSSL CA store location is dependent on configuration of the
299 OpenSSL library but this can be altered at runtime using environ‐
300 ment variables.
301
302 See SSL_CERT_DIR and SSL_CERT_FILE.
303
304 --v8-options
305 Print V8 command-line options.
306
307 --v8-pool-size=num
308 Set V8's thread pool size which will be used to allocate back‐
309 ground jobs. If set to 0 then V8 will choose an appropriate size
310 of the thread pool based on the number of online processors. If
311 the value provided is larger than V8's maximum, then the largest
312 value will be chosen.
313
314 --zero-fill-buffers
315 Automatically zero-fills all newly allocated Buffer and Slow‐
316 Buffer instances.
317
318 -c, --check
319 Check the script's syntax without executing it. Exits with an
320 error code if script is invalid.
321
322 -e, --eval string
323 Evaluate string as JavaScript.
324
325 -h, --help
326 Print command-line options. The output of this option is less
327 detailed than this document.
328
329 -i, --interactive
330 Open the REPL even if stdin does not appear to be a terminal.
331
332 -p, --print string
333 Identical to -e, but prints the result.
334
335 -r, --require module
336 Preload the specified module at startup. Follows `require()`'s
337 module resolution rules. module may be either a path to a file,
338 or a Node.js module name.
339
340 -v, --version
341 Print node's version.
342
344 NODE_DEBUG modules...
345 Comma-separated list of core modules that should print debug
346 information.
347
348 NODE_DEBUG_NATIVE modules...
349 Comma-separated list of C++ core modules that should print debug
350 information.
351
352 NODE_DISABLE_COLORS
353 When set to 1, colors will not be used in the REPL.
354
355 NODE_EXTRA_CA_CERTS file
356 When set, the well-known “root” CAs (like VeriSign) will be
357 extended with the extra certificates in file. The file should
358 consist of one or more trusted certificates in PEM format.
359
360 If file is missing or misformatted, a message will be emitted
361 once using process.emitWarning(), but any errors are otherwise
362 ignored.
363
364 This environment variable is ignored when `node` runs as setuid
365 root or has Linux file capabilities set.
366
367 NODE_ICU_DATA file
368 Data path for ICU (Intl object) data. Will extend linked-in data
369 when compiled with small-icu support.
370
371 NODE_NO_WARNINGS
372 When set to 1, process warnings are silenced.
373
374 NODE_OPTIONS options...
375 A space-separated list of command-line options, which are inter‐
376 preted as if they had been specified on the command-line before
377 the actual command (so they can be overridden). Node.js will
378 exit with an error if an option that is not allowed in the envi‐
379 ronment is used, such as --print or a script file.
380
381 NODE_PATH directories...
382 A colon-separated list of directories prefixed to the module
383 search path.
384
385 NODE_PENDING_DEPRECATION
386 When set to 1, emit pending deprecation warnings.
387
388 NODE_PRESERVE_SYMLINKS
389 When set to 1, the module loader preserves symbolic links when
390 resolving and caching modules.
391
392 NODE_REDIRECT_WARNINGS file
393 Write process warnings to the given file instead of printing to
394 stderr. Equivalent to passing --redirect-warnings file on com‐
395 mand-line.
396
397 NODE_REPL_HISTORY file
398 Path to the file used to store persistent REPL history. The
399 default path is ~/.node_repl_history, which is overridden by this
400 variable. Setting the value to an empty string ("" or " ") will
401 disable persistent REPL history.
402
403 NODE_TLS_REJECT_UNAUTHORIZED
404 When set to 0, TLS certificate validation is disabled.
405
406 NODE_V8_COVERAGE dir
407 When set, Node.js writes JavaScript code coverage information to
408 dir.
409
410 OPENSSL_CONF file
411 Load an OpenSSL configuration file on startup. Among other uses,
412 this can be used to enable FIPS-compliant crypto if Node.js is
413 built with ./configure --openssl-fips.
414
415 If the --openssl-config command-line option is used, this envi‐
416 ronment variable is ignored.
417
418 SSL_CERT_DIR dir
419 If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
420 directory containing trusted certificates.
421
422 SSL_CERT_FILE file
423 If --use-openssl-ca is enabled, this overrides and sets OpenSSL's
424 file containing trusted certificates.
425
426 UV_THREADPOOL_SIZE size
427 Sets the number of threads used in libuv's threadpool to size.
428
430 Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
431
433 Copyright Node.js contributors. Node.js is available under the MIT
434 license.
435
436 Node.js also includes external libraries that are available under a vari‐
437 ety of licenses. See https://github.com/nodejs/node/blob/master/LICENSE
438 for the full license text.
439
441 Website: https://nodejs.org/
442
443 Documentation: https://nodejs.org/api/
444
445 GitHub repository & Issue Tracker: https://github.com/nodejs/node
446
447 IRC (general questions): chat.freenode.net #node.js (unofficial)
448
449 IRC (Node.js core development): chat.freenode.net #node-dev
450
452 Written and maintained by 1000+ contributors:
453 https://github.com/nodejs/node/blob/master/AUTHORS
454
455 December 31, 2019