NODE-20(1)
π NODE-20(1) β the node manual, but make it make sense π
okay bestie, pull up a chair, grab a boba π§, because we're about to go through node β the server-side JavaScript runtime β and I promise it's gonna be fun. manual page NODE-20(1), for the record. this is part 1, so don't you dare think we're done here.
β¨ NAME β¨
node β server-side JavaScript runtime π«Ά
π SYNOPSIS π
node [options] [v8-options] [-e string | script.js | -] [--]
[arguments ...]
node inspect [-e string | script.js | - | <host>:<port>] ...
node [--v8-options]
look at that. three whole moods. pick your fighter π
π¦ DESCRIPTION π¦
Node.js is literally a set of libraries for JavaScript that lets you use it outside of the browser. no cap. it's mainly focused on making simple, easy-to-build network clients and servers β like, that's its whole thing, that's its brand.
and listen: if you run node with no arguments at all? it starts a REPL. just you and your thoughts and an interactive prompt. iconic behavior honestly. β¨
π OPTIONS π
okay this is the big one. every single flag, no skips, no shortcuts. let's go π
-β an alias for stdin, same energy as using-in other command-line utilities. the script gets read from stdin, and whatever arguments are left over get passed to the script. cute.--β this one says "okay, command-line options are DONE." everything after it gets passed straight to the script.
heads up: if you haven't supplied a script filename or an eval/print script before this, then the next argument becomes the script filename. so like, order matters, bestie.
--abort-on-uncaught-exceptionβ instead of just exiting, it aborts, which means a core file gets generated for analysis. π dramatic but useful.--allow-fs-readβ allow file system read access when you're using the permission model.--allow-fs-writeβ allow file system write access when you're using the permission model.--allow-addonsβ allow using native addons when you're using the permission model.--allow-child-processβ allow spawning processes when you're using the permission model.--allow-wasiβ allow execution of WASI when you're using the permission model.--allow-workerβ allow creating worker threads when you're using the permission model.--completion-bashβ prints a source-able bash completion script for Node.js. tab-tab-tab your way to greatness π-C,--conditions stringβ use custom conditional exports conditions.string--cpu-profβ starts the V8 CPU profiler right on start up, and writes the CPU profile to disk before exit. if--cpu-prof-dirisn't specified, the profile goes to the current working directory with a generated file name. β¨--cpu-prof-dirβ the directory where the CPU profiles made by--cpu-profget placed. the default value is controlled by the--diagnostic-dircommand-line option.--cpu-prof-intervalβ the sampling interval, in microseconds, for the CPU profiles made by--cpu-prof. the default is1000.--cpu-prof-nameβ file name of the V8 CPU profile generated with--cpu-prof.--diagnostic-dirβ sets the directory for all diagnostic output files. default is the current working directory. (yes, it says that twice in the original, and honestly? it means it.) set the directory to which all diagnostic output files will be written to; defaults to current working directory. it affects the default output directory of:--cpu-prof-dir,--heap-prof-dir,--redirect-warnings.--disable-proto=modeβ disables theObject.prototype.__proto__property. if mode isdelete, the property gets removed entirely. if mode isthrow, accessing the property throws an exception with the codeERR_PROTO_ACCESS.--disable-wasm-trap-handler=modeβ disables trap-handler-based WebAssembly bound checks and falls back to inline bound checks, so WebAssembly can run with limited virtual memory.--disallow-code-generation-from-stringsβ makes built-in language features that generate code from strings β likeevalandnew Functionβ throw an exception instead. note: this does not affect the Node.jsvmmodule. π--enable-fipsβ enables FIPS-compliant crypto at startup. requires Node.js to be built with./configure --openssl-fips.--enable-source-mapsβ enables Source Map V3 support for stack traces. your stack traces are about to get so much more readable, fr fr.--experimental-default-type=typeβ interprets input via--evalor STDIN as either ES modules or CommonJS modules, for when--input-typeis unspecified.--experimental-import-meta-resolveβ enables experimental ES modules support forimport.meta.resolve().--experimental-loader=moduleβ specifies the module to use as a custom module loader.--experimental-network-importsβ enables experimental support for loading modules usingimportoverhttps:.--experimental-permissionβ enables the experimental permission model. π--experimental-policyβ uses the specified file as a security policy.--experimental-shadow-realmβ use this flag to enable ShadowRealm support.--experimental-test-coverageβ enables code coverage in the test runner.--experimental-test-module-mocksβ enables module mocking in the test runner.--experimental-eventsourceβ enables experimental support for the EventSource Web API.--experimental-websocketβ enables experimental support for the WebSocket API.--no-experimental-fetchβ disables experimental support for the Fetch API.--no-experimental-global-customeventβ disables exposition of theCustomEventon the global scope.--no-experimental-global-webcryptoβ disables exposition of the Web Crypto API on the global scope.--no-experimental-repl-awaitβ disables top-levelawaitkeyword support in the REPL.--experimental-vm-modulesβ enables experimental ES module support in the VM module.--experimental-wasi-unstable-preview1β enables experimental WebAssembly System Interface support. plot twist: this flag is no longer required, because WASI is enabled by default now. π«Ά--experimental-wasm-modulesβ enables experimental WebAssembly module support.--force-context-awareβ disables loading native addons that aren't context-aware.--force-fipsβ forces FIPS-compliant crypto on startup. and no, you cannot disable it from script code. same requirements as--enable-fips. it's giving locked in π--frozen-intrinsicsβ enables experimental frozen intrinsics support.--heapsnapshot-near-heap-limit=max_countβ generates a heap snapshot when V8 heap usage approaches the heap limit. no more than the specified number of snapshots will be generated.--heapsnapshot-signal=signalβ generates a heap snapshot on the specified signal.--heap-profβ starts the V8 heap profiler on start up, and writes the heap profile to disk before exit. if--heap-prof-dirisn't specified, the profile goes to the current working directory with a generated file name. β¨--heap-prof-dirβ the directory where the heap profiles made by--heap-profget placed. the default value is controlled by the--diagnostic-dircommand-line option.--heap-prof-intervalβ the average sampling interval, in bytes, for the heap profiles made by--heap-prof. the default is512 * 1024.--heap-prof-nameβ file name of the V8 heap profile generated with--heap-prof.--icu-data-dir=fileβ specify the ICU data load path. overridesNODE_ICU_DATA. π--input-type=typeβ sets the module resolution type for input via--eval,--printor STDIN.--inspect-brk=[host:]portβ activates the inspector on host:port and breaks at the start of the user script.--inspect-port=[host:]portβ sets the host:port to be used when the inspector is activated.--inspect-publish-uid=stderr,httpβ specifies how the inspector WebSocket URL is exposed. valid values arestderrandhttp. default isstderr,http.--inspect-wait=[host:]portβ activates the inspector on host:port and waits for a debugger to be attached. patient queen behavior π--inspect=[host:]portβ activates the inspector on host:port. default is127.0.0.1:9229.
V8 Inspector integration lets you attach Chrome DevTools and IDEs to Node.js instances for debugging and profiling. it uses the Chrome DevTools Protocol. this is the good stuff, bestie π₯
--insecure-http-parserβ uses an insecure HTTP parser that accepts invalid HTTP headers. this may allow interoperability with non-conformant HTTP implementations. it may also allow request smuggling and other HTTP attacks that rely on invalid headers being accepted.
avoid using this option. like, genuinely. π©
--jitlessβ disables runtime allocation of executable memory. this may be required on some platforms for security reasons. it can also reduce attack surface on other platforms, but the performance impact may be severe. π
this flag is inherited from V8 and is subject to change upstream. it may disappear in a non-semver-major release.
--max-http-header-size=sizeβ specifies the maximum size of HTTP headers in bytes. defaults to16 KiB.--napi-modulesβ this option is a no-op. it's just kept around for compatibility. it's giving "still here for the plot" π--no-deprecationβ silences deprecation warnings.--no-extra-info-on-fatal-exceptionβ hides extra information on the fatal exception that causes exit.--no-force-async-hooks-checksβ disables runtime checks forasync_hooks. these will still be enabled dynamically whenasync_hooksis enabled.--no-addonsβ disables thenode-addonsexports condition, and also disables loading native addons. when--no-addonsis specified, callingprocess.dlopenor requiring a native C++ addon will fail and throw an exception.--no-global-search-pathsβ don't search modules from global paths.--no-warningsβ silences all process warnings, including deprecations. π€«--node-memory-debugβ enables extra debug checks for memory leaks in Node.js internals. usually this is only useful for developers debugging Node.js itself. (hi, that's a very specific person and we love them)--openssl-config=fileβ loads an OpenSSL configuration file on startup. among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with./configure --openssl-fips.--pending-deprecationβ emits pending deprecation warnings.--policy-integrity=sriβ tells Node.js to error before running any code if the policy doesn't have the specified integrity. it expects a Subresource Integrity string as a parameter.--preserve-symlinksβ tells the module loader to preserve symbolic links when resolving and caching modules other than the main module.--preserve-symlinks-mainβ tells the module loader to preserve symbolic links when resolving and caching the main module. yes, it's a separate flag. yes, it matters. π--profβ generate V8 profiler output.--prof-processβ process V8 profiler output generated using the V8 option--prof.
okay that's the end of part 1, but we are SO not done. more parts coming, don't go anywhere bestie π¦π
--redirect-warnings=fileβ tired of warnings just vibing all over your stderr? This sends process warnings into the file you name instead. Clean terminal, clean mind.--report-compactβ writes diagnostic reports in a compact format, i.e. single-line JSON. No giant multi-line blob, just one tidy line.--report-dir,--report-directoryβ the location at which the diagnostic report will be generated. Thefilename may be an absolute path. If it isn't, the default directory it will be written to is controlled by the--diagnostic-dircommand-line option.--report-filenameβ the name of the file to which the diagnostic report will be written. you get to name the baby.--report-on-fatalerrorβ enables the diagnostic report to be triggered on fatal errors (internal errors within the Node.js runtime such as out of memory) that lead to termination of the application. Lowkey so useful for inspecting various diagnostic data elements like heap, stack, event loop state, resource consumption etc. so you can actually reason about the fatal error.--report-on-signalβ enables a diagnostic report to be generated upon receiving the specified (or predefined) signal to the running Node.js process. Default signal isSIGUSR2.--report-signalβ sets or resets the signal for diagnostic report generation (not supported on Windows, bestie). Default signal isSIGUSR2.--report-uncaught-exceptionβ enables a diagnostic report to be generated on un-caught exceptions. Chef's kiss when you're inspecting the JavaScript stack in conjunction with the native stack and other runtime environment data.--secure-heap=nβ specify the size of the OpenSSL secure heap. Any value less than2disables the secure heap. The default is0. The value must be a power of two.--secure-heap-min=nβ specify the minimum allocation from the OpenSSL secure heap. The default is2. The value must be a power of two.--testβ starts the Node.js command line test runner. periodt.--test-concurrencyβ the maximum number of test files that the test runner CLI will execute concurrently.--test-force-exitβ configures the test runner to exit the process once all known tests have finished executing, even if the event loop would otherwise remain active.--test-name-patternβ a regular expression that configures the test runner to only execute tests whose name matches the provided pattern.--test-reporterβ a test reporter to use when running tests.--test-reporter-destinationβ the destination for the corresponding test reporter.--test-onlyβ configures the test runner to only execute top level tests that have theonlyoption set.--test-shardβ test suite shard to execute, in a format of<index>/<total>.--test-timeoutβ a number of milliseconds the test execution will fail after.--throw-deprecationβ throw errors for deprecations. no more silent shame, we're throwing hands (errors) instead--title=titleβ specifyprocess.titleon startup.--tls-cipher-list=listβ specify an alternative default TLS cipher list. Requires Node.js to be built with crypto support. (Default)--tls-keylog=fileβ log TLS key material to a file. The key material is in NSSSSLKEYLOGFILEformat and can be used by software (such as Wireshark) to decrypt the TLS traffic. iykyk π¦--tls-max-v1.2β set defaultmaxVersionto'TLSv1.2'. Use to disable support for TLSv1.3.--tls-max-v1.3β set defaultmaxVersionto'TLSv1.3'. Use to enable support for TLSv1.3.--tls-min-v1.0β set defaultminVersionto'TLSv1'. Use for compatibility with old TLS clients or servers.--tls-min-v1.1β set defaultminVersionto'TLSv1.1'. Use for compatibility with old TLS clients or servers.--tls-min-v1.2β set defaultminVersionto'TLSv1.2'. This is the default for 12.x and later, but the option is supported for compatibility with older Node.js versions.--tls-min-v1.3β set defaultminVersionto'TLSv1.3'. Use to disable support for TLSv1.2 in favour of TLSv1.3, which is more secure. we love a security glow-up β¨--trace-atomics-waitβ print short summaries of calls toAtomics.wait(). This flag is deprecated.--trace-deprecationβ print stack traces for deprecations.--trace-event-categories categoriesβ a comma-separated list of categories that should be traced when trace event tracing is enabled using--trace-events-enabled.--trace-event-file-pattern patternβ a template string specifying the filepath for the trace event data. It supports${rotation}and${pid}.--trace-events-enabledβ enable the collection of trace event tracing information.--trace-exitβ prints a stack trace whenever an environment is exited proactively, i.e. invokingprocess.exit().--trace-sigintβ prints a stack trace onSIGINT.--trace-sync-ioβ print a stack trace whenever synchronous I/O is detected after the first turn of the event loop.--trace-tlsβ prints TLS packet trace information tostderr.--trace-uncaughtβ print stack traces for uncaught exceptions. Usually, the stack trace associated with the creation of anErroris printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be anErrorinstance).
Heads up: enabling this option may affect garbage collection behavior negatively.
--trace-warningsβ print stack traces for process warnings (including deprecations).--track-heap-objectsβ track heap object allocations for heap snapshots.--unhandled-rejections=modeβ define the behavior for unhandled rejections. mode can be one ofstrict(raise an error),warn(enforce warnings) ornone(silence warnings).--use-bundled-ca,--use-openssl-caβ use the bundled Mozilla CA store as supplied by the current Node.js version, or use OpenSSL's default CA store. The default store is selectable at build-time.
The bundled CA store, as supplied by Node.js, is a snapshot of the Mozilla CA store that is fixed at release time. It is identical on all supported platforms.
Using the OpenSSL store allows for external modifications of the store. For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators. The OpenSSL CA store location is dependent on configuration of the OpenSSL library, but this can be altered at runtime using environment variables.
See SSL_CERT_DIR and SSL_CERT_FILE.
--use-largepages=modeβ re-map the Node.js static code to large memory pages at startup. If it's supported on the target system, this will cause the Node.js static code to be moved onto 2 MiB pages instead of 4 KiB pages. big pages, big energy π«Ά
mode must have one of the following values: off (the default value, meaning do not map), on (map and ignore failure, reporting it to stderr), or silent (map and silently ignore failure).
--v8-optionsβ print V8 command-line options.--v8-pool-size=numβ set V8's thread pool size, which will be used to allocate background jobs. If set to0then V8 will choose an appropriate size of the thread pool based on the number of online processors. If the value provided is larger than V8's maximum, then the largest value will be chosen.--zero-fill-buffersβ automatically zero-fills all newly allocatedBufferandSlowBufferinstances.-c,--checkβ check the script's syntax without executing it. Exits with an error code if the script is invalid.-e,--eval stringβ evaluate string as JavaScript.-h,--helpβ print command-line options. The output of this option is less detailed than this document. (yes, the very doc you're reading rn π )-i,--interactiveβ open the REPL even ifstdindoes not appear to be a terminal.-p,--print stringβ identical to-e, but prints the result.-r,--require moduleβ preload the specified module at startup. Followsrequire()'s module resolution rules. module may be either a path to a file, or a Node.js module name.-v,--versionβ print node's version.
okay don't go anywhere, there's more coming π
π ENVIRONMENT π
okay bestie, this is the part where Node.js reads your vibes from the shell before it even gets going. Every single one of these is an environment variable, and they're all lowkey iconic. π
FORCE_COLORβ turns on ANSI colorized output, periodt. The value can be1,true, or an empty string to say "gimme 16-color support",2for 256-color support, or3for the full 16 million-color glow-up β¨. When it's used and set to a supported value, bothNO_COLORandNODE_DISABLE_COLORSget straight-up ignored. Any other value? Colorized output is disabled. no cap.NO_COLORβ literally just an alias forNODE_DISABLE_COLORS. same energy, different name πNODE_DEBUGmodules... β a comma-separated list of core modules that should print debug info. spill the tea, core modules π«NODE_DEBUG_NATIVEmodules... β same thing but for the C++ core modules. the native girlies get their own list πNODE_DISABLE_COLORSβ set it to1and the REPL stops using colors. that's it, that's the whole job.NODE_EXTRA_CA_CERTSfile β when you set this, the well-known "root" CAs (think VeriSign) get extended with the extra certificates sitting in file. The file should have one or more trusted certificates in PEM format. π
If file is missing or misformatted, a message gets emitted once using process.emitWarning(), but any errors are otherwise ignored. she's forgiving like that π
this environment variable gets ignored when node runs as setuid root or has Linux file capabilities set.
Also important: NODE_EXTRA_CA_CERTS is only read when the Node.js process is first launched. Changing the value at runtime with process.env.NODE_EXTRA_CA_CERTS does nothing to the current process. it's giving "too late bestie" π
NODE_ICU_DATAfile β the data path for ICU (theIntlobject) data. It'll extend linked-in data when compiled withsmall-icusupport.NODE_NO_WARNINGSβ set it to1and process warnings are silenced. peace and quiet, we love to see it π€«NODE_OPTIONSoptions... β a space-separated list of command-line options, interpreted as if they'd been typed on the command line before the actual command (so they can be overridden). β οΈ Node.js will exit with an error if you use an option that isn't allowed in the environment β like--printor a script file. not every option is invited to this party.NODE_PATHdirectories... β a colon-separated list of directories that gets prefixed to the module search path. ποΈNODE_PENDING_DEPRECATIONβ set it to1and you'll get pending deprecation warnings emitted. the foreshadowing β¨NODE_PRESERVE_SYMLINKSβ set it to1and the module loader preserves symbolic links when resolving and caching modules. πNODE_REDIRECT_WARNINGSfile β writes process warnings to file instead of printing them to stderr. Equivalent to passing--redirect-warnings fileon the command line. two paths, one outcome πNODE_REPL_HISTORYfile β the path to the file where your persistent REPL history lives. The default is~/.node_repl_history, and this variable overrides it. Set the value to an empty string (""or" ") and persistent REPL history is disabled. your secrets are safe, main character π΅οΈNODE_REPL_EXTERNAL_MODULEfile β the path to a Node.js module that gets loaded in place of the built-in REPL. Override this value to an empty string ('') and you get the built-in REPL back. πNODE_SKIP_PLATFORM_CHECKβ set it to1and the check for a supported platform gets skipped during Node.js startup. β οΈ Node.js might not execute correctly. Any issues you hit on unsupported platforms will not be fixed. you're on your own, babe, and we say that with love.NODE_TLS_REJECT_UNAUTHORIZEDβ set it to0and TLS certificate validation is disabled. π¨ huge red flag energy, do this only if you truly know what you're doing.NODE_V8_COVERAGEdir β when set, Node.js writes JavaScript code coverage information to dir. slay, now you know what your tests actually touched πOPENSSL_CONFfile β loads an OpenSSL configuration file on startup. Among other uses, this can enable FIPS-compliant crypto if Node.js was built with./configure --openssl-fips.
If the --openssl-config command-line option is used, this environment variable gets ignored. sorry bestie, the command line won this one π
SSL_CERT_DIRdir β if--use-openssl-cais enabled, this overrides and sets OpenSSL's directory containing trusted certificates.SSL_CERT_FILEfile β if--use-openssl-cais enabled, this overrides and sets OpenSSL's file containing trusted certificates.TZβ specify the timezone configuration. β° (yes, it's just that. a whole timezone, two little letters.)UV_THREADPOOL_SIZEsize β sets the number of threads used in libuv's threadpool to size. π§΅
π BUGS π
Bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues
found a lil glitch? go tell the repo. they're tracking them, fr fr. π
π COPYRIGHT π
Copyright Node.js contributors. Node.js is available under the MIT license.
Node.js also includes external libraries that are available under a variety of licenses. See https://github.com/nodejs/node/blob/HEAD/LICENSE for the full license text.
π¦ SEE ALSO π¦
- Website:
https://nodejs.org/ - Documentation:
https://nodejs.org/api/ - GitHub repository and issue tracker:
https://github.com/nodejs/node
and that's the whole page, bestie π«Ά this was the NODE(1) manual, dated 2018, and you read every single line of it. not me being proud of you π go write some absolutely iconic code, and remember: read the docs, check the flags, and never disable TLS validation in prod. mwah πβ¨π
π¦ where this page comes from
- fedora 43: nodejs20 1:20.20.2-3.fc43 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- fedora 43: nodejs20 1:20.20.2-3.fc43 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- fedora 44: nodejs20 1:20.20.0-5.fc44 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- fedora 44: nodejs20 1:20.20.0-5.fc44 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- fedora 44: nodejs20 1:20.20.2-3.fc44 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- fedora 44: nodejs20 1:20.20.2-3.fc44 Β· Apache-2.0 AND Artistic-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BlueOak-1.0.0 AND CC-BY-3.0 AND CC0-1.0 AND ISC AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms