1.\" 2.\" This manpage is written in mdoc(7). 3.\" 4.\" * Language reference: 5.\" https://man.openbsd.org/mdoc.7 6.\" 7.\" * Atom editor support: 8.\" https://atom.io/packages/language-roff 9.\" 10.\" * Linting changes: 11.\" mandoc -Wall -Tlint /path/to/this.file # BSD 12.\" groff -w all -z /path/to/this.file # GNU/Linux, macOS 13.\" 14.\" 15.\" Before making changes, please note the following: 16.\" 17.\" * In Roff, each new sentence should begin on a new line. This gives 18.\" the Roff formatter better control over text-spacing, line-wrapping, 19.\" and paragraph justification. 20.\" 21.\" * Do not leave blank lines in the markup. If whitespace is desired 22.\" for readability, put a dot in the first column to indicate a null/empty 23.\" command. Comments and horizontal whitespace may optionally follow: each 24.\" of these lines are an example of a null command immediately followed by 25.\" a comment. 26.\" 27.\"====================================================================== 28. 29.Dd 2018 30.Dt NODE 1 31. 32.Sh NAME 33.Nm node 34.Nd server-side JavaScript runtime 35. 36.\"====================================================================== 37.Sh SYNOPSIS 38.Nm node 39.Op Ar options 40.Op Ar v8-options 41.Op Fl e Ar string | Ar script.js | Fl 42.Op Fl - 43.Op Ar arguments ... 44. 45.Nm node 46.Cm inspect 47.Op Fl e Ar string | Ar script.js | Fl | Ar <host>:<port> 48.Ar ... 49. 50.Nm node 51.Op Fl -v8-options 52. 53.\"====================================================================== 54.Sh DESCRIPTION 55Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser. 56It is primarily focused on creating simple, easy-to-build network clients and servers. 57.Pp 58Execute 59.Nm 60without arguments to start a REPL. 61. 62.Sh OPTIONS 63.Bl -tag -width 6n 64.It Sy - 65Alias for stdin, analogous to the use of - in other command-line utilities. 66The executed script is read from stdin, and remaining arguments are passed to the script. 67. 68.It Fl - 69Indicate the end of command-line options. 70Pass the rest of the arguments to the script. 71.Pp 72If no script filename or eval/print script is supplied prior to this, then 73the next argument will be used as a script filename. 74. 75.It Fl -abort-on-uncaught-exception 76Aborting instead of exiting causes a core file to be generated for analysis. 77. 78.It Fl -completion-bash 79Print source-able bash completion script for Node.js. 80. 81.It Fl C , Fl -conditions Ar string 82Use custom conditional exports conditions. 83.Ar string 84. 85.It Fl -cpu-prof 86Start the V8 CPU profiler on start up, and write the CPU profile to disk 87before exit. If 88.Fl -cpu-prof-dir 89is not specified, the profile will be written to the current working directory 90with a generated file name. 91. 92.It Fl -cpu-prof-dir 93The directory where the CPU profiles generated by 94.Fl -cpu-prof 95will be placed. 96The default value is controlled by the 97.Fl -diagnostic-dir . 98command-line option. 99. 100.It Fl -cpu-prof-interval 101The sampling interval in microseconds for the CPU profiles generated by 102.Fl -cpu-prof . 103The default is 104.Sy 1000 . 105. 106.It Fl -cpu-prof-name 107File name of the V8 CPU profile generated with 108.Fl -cpu-prof . 109. 110.It Fl -diagnostic-dir 111Set the directory for all diagnostic output files. 112Default is current working directory. 113Set the directory to which all diagnostic output files will be written to. 114Defaults to current working directory. 115. 116Affects the default output directory of: 117.Fl -cpu-prof-dir . 118.Fl -heap-prof-dir . 119.Fl -redirect-warnings . 120. 121.It Fl -disable-proto Ns = Ns Ar mode 122Disable the `Object.prototype.__proto__` property. If 123.Ar mode 124is `delete`, the property will be removed entirely. If 125.Ar mode 126is `throw`, accesses to the property will throw an exception with the code 127`ERR_PROTO_ACCESS`. 128. 129.It Fl -disallow-code-generation-from-strings 130Make built-in language features like `eval` and `new Function` that generate 131code from strings throw an exception instead. This does not affect the Node.js 132`vm` module. 133. 134.It Fl -enable-fips 135Enable FIPS-compliant crypto at startup. 136Requires Node.js to be built with 137.Sy ./configure --openssl-fips . 138. 139.It Fl -experimental-abortcontroller 140Enable experimental AbortController and AbortSignal support. 141. 142.It Fl -enable-source-maps 143Enable experimental Source Map V3 support for stack traces. 144. 145.It Fl -experimental-import-meta-resolve 146Enable experimental ES modules support for import.meta.resolve(). 147. 148.It Fl -experimental-json-modules 149Enable experimental JSON interop support for the ES Module loader. 150. 151.It Fl -experimental-loader Ns = Ns Ar module 152Specify the 153.Ar module 154to use as a custom module loader. 155. 156.It Fl -experimental-policy 157Use the specified file as a security policy. 158. 159.It Fl -experimental-repl-await 160Enable experimental top-level 161.Sy await 162keyword support in REPL. 163. 164.It Fl -experimental-specifier-resolution 165Select extension resolution algorithm for ES Modules; either 'explicit' (default) or 'node'. 166. 167.It Fl -experimental-vm-modules 168Enable experimental ES module support in VM module. 169. 170.It Fl -experimental-wasi-unstable-preview1 171Enable experimental WebAssembly System Interface support. 172. 173.It Fl -experimental-wasm-modules 174Enable experimental WebAssembly module support. 175. 176.It Fl -force-context-aware 177Disable loading native addons that are not context-aware. 178. 179.It Fl -force-fips 180Force FIPS-compliant crypto on startup 181(Cannot be disabled from script code). 182Same requirements as 183.Fl -enable-fips . 184. 185.It Fl -frozen-intrinsics 186Enable experimental frozen intrinsics support. 187. 188.It Fl -heapsnapshot-near-heap-limit Ns = Ns Ar max_count 189Generate heap snapshot when the V8 heap usage is approaching the heap limit. 190No more than the specified number of snapshots will be generated. 191. 192.It Fl -heapsnapshot-signal Ns = Ns Ar signal 193Generate heap snapshot on specified signal. 194. 195.It Fl -heap-prof 196Start the V8 heap profiler on start up, and write the heap profile to disk 197before exit. If 198.Fl -heap-prof-dir 199is not specified, the profile will be written to the current working directory 200with a generated file name. 201. 202.It Fl -heap-prof-dir 203The directory where the heap profiles generated by 204.Fl -heap-prof 205will be placed. 206The default value is controlled by the 207.Fl -diagnostic-dir . 208command-line option. 209. 210.It Fl -heap-prof-interval 211The average sampling interval in bytes for the heap profiles generated by 212.Fl -heap-prof . 213The default is 214.Sy 512 * 1024 . 215. 216.It Fl -heap-prof-name 217File name of the V8 heap profile generated with 218.Fl -heap-prof . 219. 220.It Fl -icu-data-dir Ns = Ns Ar file 221Specify ICU data load path. 222Overrides 223.Ev NODE_ICU_DATA . 224. 225.It Fl -input-type Ns = Ns Ar type 226Set the module resolution type for input via --eval, --print or STDIN. 227. 228.It Fl -inspect-brk Ns = Ns Ar [host:]port 229Activate inspector on 230.Ar host:port 231and break at start of user script. 232. 233.It Fl -inspect-port Ns = Ns Ar [host:]port 234Set the 235.Ar host:port 236to be used when the inspector is activated. 237. 238.It Fl -inspect-publish-uid=stderr,http 239Specify how the inspector WebSocket URL is exposed. 240Valid values are 241.Sy stderr 242and 243.Sy http . 244Default is 245.Sy stderr,http . 246. 247.It Fl -inspect Ns = Ns Ar [host:]port 248Activate inspector on 249.Ar host:port . 250Default is 251.Sy 127.0.0.1:9229 . 252.Pp 253V8 Inspector integration allows attaching Chrome DevTools and IDEs to Node.js instances for debugging and profiling. 254It uses the Chrome DevTools Protocol. 255. 256.It Fl -insecure-http-parser 257Use an insecure HTTP parser that accepts invalid HTTP headers. This may allow 258interoperability with non-conformant HTTP implementations. It may also allow 259request smuggling and other HTTP attacks that rely on invalid headers being 260accepted. Avoid using this option. 261. 262.It Fl -jitless 263Disable runtime allocation of executable memory. This may be required on 264some platforms for security reasons. It can also reduce attack surface on 265other platforms, but the performance impact may be severe. 266. 267.Pp 268This flag is inherited from V8 and is subject to change upstream. It may 269disappear in a non-semver-major release. 270. 271.It Fl -max-http-header-size Ns = Ns Ar size 272Specify the maximum size of HTTP headers in bytes. Defaults to 16KB. 273. 274.It Fl -napi-modules 275This option is a no-op. 276It is kept for compatibility. 277. 278.It Fl -no-deprecation 279Silence deprecation warnings. 280. 281.It Fl -no-force-async-hooks-checks 282Disable runtime checks for `async_hooks`. 283These will still be enabled dynamically when `async_hooks` is enabled. 284. 285.It Fl -no-addons 286Disable the `node-addons` exports condition as well as disable loading native 287addons. When `--no-addons` is specified, calling `process.dlopen` or requiring 288a native C++ addon will fail and throw an exception. 289. 290.It Fl -no-warnings 291Silence all process warnings (including deprecations). 292. 293.It Fl -node-memory-debug 294Enable extra debug checks for memory leaks in Node.js internals. This is 295usually only useful for developers debugging Node.js itself. 296. 297.It Fl -openssl-config Ns = Ns Ar file 298Load an OpenSSL configuration file on startup. 299Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with 300.Sy ./configure --openssl-fips . 301. 302.It Fl -pending-deprecation 303Emit pending deprecation warnings. 304. 305.It Fl -policy-integrity Ns = Ns Ar sri 306Instructs Node.js to error prior to running any code if the policy does not have the specified integrity. It expects a Subresource Integrity string as a parameter. 307. 308.It Fl -preserve-symlinks 309Instructs the module loader to preserve symbolic links when resolving and caching modules other than the main module. 310. 311.It Fl -preserve-symlinks-main 312Instructs the module loader to preserve symbolic links when resolving and caching the main module. 313. 314.It Fl -prof 315Generate V8 profiler output. 316. 317.It Fl -prof-process 318Process V8 profiler output generated using the V8 option 319.Fl -prof . 320. 321.It Fl -redirect-warnings Ns = Ns Ar file 322Write process warnings to the given 323.Ar file 324instead of printing to stderr. 325. 326.It Fl -report-compact 327Write 328.Sy diagnostic reports 329in a compact format, single-line JSON. 330. 331.It Fl -report-dir Fl -report-directory 332Location at which the 333.Sy diagnostic report 334will be generated. 335The `file` name may be an absolute path. If it is not, the default directory it will 336be written to is controlled by the 337.Fl -diagnostic-dir . 338command-line option. 339. 340.It Fl -report-filename 341Name of the file to which the 342.Sy diagnostic report 343will be written. 344. 345.It Fl -report-on-fatalerror 346Enables the 347.Sy diagnostic report 348to be triggered on fatal errors (internal errors within the Node.js runtime such 349as out of memory) that leads to termination of the application. Useful to 350inspect various diagnostic data elements such as heap, stack, event loop state, 351resource consumption etc. to reason about the fatal error. 352. 353.It Fl -report-on-signal 354Enables 355.Sy diagnostic report 356to be generated upon receiving the specified (or predefined) signal to the 357running Node.js process. Default signal is SIGUSR2. 358. 359.It Fl -report-signal 360Sets or resets the signal for 361.Sy diagnostic report 362generation (not supported on Windows). Default signal is SIGUSR2. 363. 364.It Fl -report-uncaught-exception 365Enables 366.Sy diagnostic report 367to be generated on un-caught exceptions. Useful when inspecting JavaScript 368stack in conjunction with native stack and other runtime environment data. 369. 370.It Fl -throw-deprecation 371Throw errors for deprecations. 372. 373.It Fl -title Ns = Ns Ar title 374Specify process.title on startup. 375. 376.It Fl -tls-cipher-list Ns = Ns Ar list 377Specify an alternative default TLS cipher list. 378Requires Node.js to be built with crypto support. (Default) 379. 380.It Fl -tls-keylog Ns = Ns Ar file 381Log TLS key material to a file. The key material is in NSS SSLKEYLOGFILE 382format and can be used by software (such as Wireshark) to decrypt the TLS 383traffic. 384. 385.It Fl -tls-max-v1.2 386Set default maxVersion to 'TLSv1.2'. Use to disable support for TLSv1.3. 387. 388.It Fl -tls-max-v1.3 389Set default maxVersion to 'TLSv1.3'. Use to enable support for TLSv1.3. 390. 391.It Fl -tls-min-v1.0 392Set default minVersion to 'TLSv1'. Use for compatibility with old TLS clients 393or servers. 394. 395.It Fl -tls-min-v1.1 396Set default minVersion to 'TLSv1.1'. Use for compatibility with old TLS clients 397or servers. 398. 399.It Fl -tls-min-v1.2 400Set default minVersion to 'TLSv1.2'. This is the default for 12.x and later, 401but the option is supported for compatibility with older Node.js versions. 402. 403.It Fl -tls-min-v1.3 404Set default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in 405favour of TLSv1.3, which is more secure. 406. 407.It Fl -trace-atomics-wait 408Print short summaries of calls to 409.Sy Atomics.wait() . 410. 411.It Fl -trace-deprecation 412Print stack traces for deprecations. 413. 414.It Fl -trace-event-categories Ar categories 415A comma-separated list of categories that should be traced when trace event tracing is enabled using 416.Fl -trace-events-enabled . 417. 418.It Fl -trace-event-file-pattern Ar pattern 419Template string specifying the filepath for the trace event data, it 420supports 421.Sy ${rotation} 422and 423.Sy ${pid} . 424. 425.It Fl -trace-events-enabled 426Enable the collection of trace event tracing information. 427. 428.It Fl -trace-exit 429Prints a stack trace whenever an environment is exited proactively, 430i.e. invoking `process.exit()`. 431.It Fl -trace-sigint 432Prints a stack trace on SIGINT. 433. 434.It Fl -trace-sync-io 435Print a stack trace whenever synchronous I/O is detected after the first turn of the event loop. 436. 437.It Fl -trace-tls 438Prints TLS packet trace information to stderr. 439. 440.It Fl -trace-uncaught 441Print stack traces for uncaught exceptions; usually, the stack trace associated 442with the creation of an 443.Sy Error 444is printed, whereas this makes Node.js also 445print the stack trace associated with throwing the value (which does not need 446to be an 447.Sy Error 448instance). 449.Pp 450Enabling this option may affect garbage collection behavior negatively. 451. 452.It Fl -trace-warnings 453Print stack traces for process warnings (including deprecations). 454. 455.It Fl -track-heap-objects 456Track heap object allocations for heap snapshots. 457. 458.It Fl -unhandled-rejections=mode 459Define the behavior for unhandled rejections. Can be one of `strict` (raise an error), `warn` (enforce warnings) or `none` (silence warnings). 460. 461.It Fl -use-bundled-ca , Fl -use-openssl-ca 462Use bundled Mozilla CA store as supplied by current Node.js version or use OpenSSL's default CA store. 463The default store is selectable at build-time. 464.Pp 465The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store that is fixed at release time. 466It is identical on all supported platforms. 467.Pp 468Using OpenSSL store allows for external modifications of the store. 469For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators. 470OpenSSL CA store location is dependent on configuration of the OpenSSL library but this can be altered at runtime using environment variables. 471.Pp 472See 473.Ev SSL_CERT_DIR 474and 475.Ev SSL_CERT_FILE . 476. 477.It Fl -use-largepages Ns = Ns Ar mode 478Re-map the Node.js static code to large memory pages at startup. If supported on 479the target system, this will cause the Node.js static code to be moved onto 2 480MiB pages instead of 4 KiB pages. 481.Pp 482.Ar mode 483must have one of the following values: 484`off` (the default value, meaning do not map), `on` (map and ignore failure, 485reporting it to stderr), or `silent` (map and silently ignore failure). 486. 487.It Fl -v8-options 488Print V8 command-line options. 489. 490.It Fl -v8-pool-size Ns = Ns Ar num 491Set V8's thread pool size which will be used to allocate background jobs. 492If set to 0 then V8 will choose an appropriate size of the thread pool based on the number of online processors. 493If the value provided is larger than V8's maximum, then the largest value will be chosen. 494. 495.It Fl -zero-fill-buffers 496Automatically zero-fills all newly allocated Buffer and SlowBuffer instances. 497. 498.It Fl c , Fl -check 499Check the script's syntax without executing it. 500Exits with an error code if script is invalid. 501. 502.It Fl e , Fl -eval Ar string 503Evaluate 504.Ar string 505as JavaScript. 506. 507.It Fl h , Fl -help 508Print command-line options. 509The output of this option is less detailed than this document. 510. 511.It Fl i , Fl -interactive 512Open the REPL even if stdin does not appear to be a terminal. 513. 514.It Fl p , Fl -print Ar string 515Identical to 516.Fl e , 517but prints the result. 518. 519.It Fl r , Fl -require Ar module 520Preload the specified 521.Ar module 522at startup. 523Follows `require()`'s module resolution rules. 524.Ar module 525may be either a path to a file, or a Node.js module name. 526. 527.It Fl v , Fl -version 528Print node's version. 529.El 530. 531.\" ===================================================================== 532.Sh ENVIRONMENT 533.Bl -tag -width 6n 534.It Ev FORCE_COLOR 535Used to enable ANSI colorized output. The value may be one of: 536.Ar 1 537, 538.Ar true 539, or 540.Ar an empty string 541to 542indicate 16-color support, 543.Ar 2 544to indicate 256-color support, or 545.Ar 3 546to indicate 16 million-color support. When used and set to a supported 547value, both the NO_COLOR and NODE_DISABLE_COLORS environment variables 548are ignored. Any other value will result in colorized output being 549disabled. 550. 551.It Ev NO_COLOR 552Alias for NODE_DISABLE_COLORS 553. 554.It Ev NODE_DEBUG Ar modules... 555Comma-separated list of core modules that should print debug information. 556. 557.It Ev NODE_DEBUG_NATIVE Ar modules... 558Comma-separated list of C++ core modules that should print debug information. 559. 560.It Ev NODE_DISABLE_COLORS 561When set to 562.Ar 1 , 563colors will not be used in the REPL. 564. 565.It Ev NODE_EXTRA_CA_CERTS Ar file 566When set, the well-known 567.Dq root 568CAs (like VeriSign) will be extended with the extra certificates in 569.Ar file . 570The file should consist of one or more trusted certificates in PEM format. 571.Pp 572If 573.Ar file 574is missing or misformatted, a message will be emitted once using 575.Sy process.emitWarning() , 576but any errors are otherwise ignored. 577.Pp 578This environment variable is ignored when `node` runs as setuid root or 579has Linux file capabilities set. 580.Pp 581The 582.Ar NODE_EXTRA_CA_CERTS 583environment variable is only read when the Node.js process is first launched. 584Changing the value at runtime using 585.Ar process.env.NODE_EXTRA_CA_CERTS 586has no effect on the current process. 587. 588.It Ev NODE_ICU_DATA Ar file 589Data path for ICU (Intl object) data. 590Will extend linked-in data when compiled with small-icu support. 591. 592.It Ev NODE_NO_WARNINGS 593When set to 594.Ar 1 , 595process warnings are silenced. 596. 597.It Ev NODE_OPTIONS Ar options... 598A space-separated list of command-line 599.Ar options , 600which are interpreted as if they had been specified on the command line before the actual command (so they can be overridden). 601Node.js will exit with an error if an option that is not allowed in the environment is used, such as 602.Fl -print 603or a script file. 604. 605.It Ev NODE_PATH Ar directories... 606A colon-separated list of 607.Ar directories 608prefixed to the module search path. 609. 610.It Ev NODE_PENDING_DEPRECATION 611When set to 612.Ar 1 , 613emit pending deprecation warnings. 614. 615.It Ev NODE_PRESERVE_SYMLINKS 616When set to 617.Ar 1 , 618the module loader preserves symbolic links when resolving and caching modules. 619. 620.It Ev NODE_REDIRECT_WARNINGS Ar file 621Write process warnings to the given 622.Ar file 623instead of printing to stderr. 624Equivalent to passing 625.Fl -redirect-warnings Ar file 626on the command line. 627.It Ev NODE_REPL_HISTORY Ar file 628Path to the 629.Ar file 630used to store persistent REPL history. 631The default path is 632.Sy ~/.node_repl_history , 633which is overridden by this variable. 634Setting the value to an empty string ("" or " ") will disable persistent REPL history. 635. 636.It Ev NODE_SKIP_PLATFORM_CHECK 637When set to 638.Ar 1 , 639the check for a supported platform is skipped during Node.js startup. 640Node.js might not execute correctly. 641Any issues encountered on unsupported platforms will not be fixed. 642. 643.It Ev NODE_TLS_REJECT_UNAUTHORIZED 644When set to 645.Ar 0 , 646TLS certificate validation is disabled. 647. 648.It Ev NODE_V8_COVERAGE Ar dir 649When set, Node.js writes JavaScript code coverage information to 650.Ar dir . 651. 652.It Ev OPENSSL_CONF Ar file 653Load an OpenSSL configuration file on startup. 654Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with 655.Sy ./configure --openssl-fips . 656.Pp 657If the 658.Fl -openssl-config 659command-line option is used, this environment variable is ignored. 660. 661.It Ev SSL_CERT_DIR Ar dir 662If 663.Fl -use-openssl-ca 664is enabled, this overrides and sets OpenSSL's directory containing trusted certificates. 665. 666.It Ev SSL_CERT_FILE Ar file 667If 668.Fl -use-openssl-ca 669is enabled, this overrides and sets OpenSSL's file containing trusted certificates. 670. 671.It Ev UV_THREADPOOL_SIZE Ar size 672Sets the number of threads used in libuv's threadpool to 673.Ar size . 674. 675.El 676.\"===================================================================== 677.Sh BUGS 678Bugs are tracked in GitHub Issues: 679.Sy https://github.com/nodejs/node/issues 680. 681.\"====================================================================== 682.Sh COPYRIGHT 683Copyright Node.js contributors. 684Node.js is available under the MIT license. 685. 686.Pp 687Node.js also includes external libraries that are available under a variety of licenses. 688See 689.Sy https://github.com/nodejs/node/blob/HEAD/LICENSE 690for the full license text. 691. 692.\"====================================================================== 693.Sh SEE ALSO 694Website: 695.Sy https://nodejs.org/ 696. 697.Pp 698Documentation: 699.Sy https://nodejs.org/api/ 700. 701.Pp 702GitHub repository and issue tracker: 703.Sy https://github.com/nodejs/node 704. 705.Pp 706IRC (general questions): 707.Sy "libera.chat #node.js" 708(unofficial) 709. 710.\"====================================================================== 711.Sh AUTHORS 712Written and maintained by 1000+ contributors: 713.Sy https://github.com/nodejs/node/blob/HEAD/AUTHORS 714