NODEJS(1)

๐ŸŒˆ hey bestie, welcome to NODE(1) ๐ŸŒˆ

Okay so NODE(1) is the manual page for the Node.js runtime, and we are gonna get through it together because there is a LOT here and it's genuinely iconic. Grab a snack ๐Ÿ“. This is part 1, and there's more coming, so don't go anywhere.


โœจ NAME โœจ

node โ€” it's the server-side JavaScript runtime, no cap. ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

Look at the shapes it can take. Every one of these is real, copy them exactly:

node [options] [v8-options] [-e string | script.js | -] [--]
     [arguments ...]
node inspect [<program-entry-point> | -e string | <host>:<port>] ...
node [--v8-options]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So. Node.js is a whole set of libraries for JavaScript that lets you run it outside of the browser. That's the entire vibe. ๐ŸŒธ

It is primarily focused on making simple, easy-to-build network clients and servers. Like, that's its main character energy.

And listen โ€” if you just run node with no arguments at all? It drops you straight into a REPL. Cute, right? ๐Ÿ’–


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

Okay this is the big one. Forty-something options. We are doing ALL of them, nobody gets left behind. ๐Ÿซถ

  • - โ€” this is an alias for stdin, same energy as using - in other command-line utilities. The script that gets executed is read from stdin, and the remaining arguments get passed along to the script. ๐Ÿ’Œ
  • -- โ€” this says the options are done, bestie. Everything after it gets passed to the script.

And plot twist: if no script filename or eval/print script was supplied before this point, then the next argument gets used as the script filename. ๐Ÿ™ˆ

  • --abort-on-uncaught-exception โ€” aborting instead of exiting causes a core file to be generated for analysis. Not exiting โ€” aborting. Different thing. ๐Ÿ’€
  • --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-inspector โ€” allow inspector access 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. Handy. โญ
  • -C, --conditions string โ€” use custom conditional exports conditions. The value is a string.
  • --cpu-prof โ€” starts the V8 CPU profiler on start up, and writes the CPU profile to disk before exit. If --cpu-prof-dir isn't specified, the profile gets written to the current working directory with a generated file name. ๐Ÿ”ฅ
  • --cpu-prof-dir โ€” the directory where the CPU profiles generated by --cpu-prof will be placed. The default value is controlled by the --diagnostic-dir command-line option.
  • --cpu-prof-interval โ€” the sampling interval in microseconds for the CPU profiles generated by --cpu-prof. The default is 1000.
  • --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. Sets 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 the Object.prototype.__proto__ property. If mode is delete, the property gets removed entirely. If mode is throw, accesses to the property will throw an exception with the code ERR_PROTO_ACCESS.
  • *--disable-wasm-trap-handler=mode* โ€” disables trap-handler-based WebAssembly bound checks and falls back to inline bound checks, so that WebAssembly can be run with limited virtual memory.
  • --disallow-code-generation-from-strings โ€” makes built-in language features like eval and new Function that generate code from strings throw an exception instead. Heads up: this does not affect the Node.js vm module. ๐Ÿงš
  • --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.
  • --entry-url โ€” interpret the entry point as a URL.
  • --experimental-addon-modules โ€” enables experimental addon module support.
  • --experimental-config-file, --experimental-config-file=config, --experimental-default-config-file โ€” if present, Node.js will look for a configuration file at the specified path. If the path is not specified, Node.js will look for a node.config.json file in the current working directory. To specify a custom path, use the --experimental-config-file=path form. The space-separated --experimental-config-file path form is not supported. Node.js will read the configuration file and apply the settings. The configuration file should be a JSON file with this structure โ€” and the vX.Y.Z in the $schema must be replaced with the version of Node.js you are using. ๐Ÿ‘‡
{
  "$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json",
  "nodeOptions": {
    "import": [
      "amaro/strip"
    ],
    "watch-path": "src",
    "watch-preserve-output": true
  },
  "testRunner": {
    "test-isolation": "process"
  },
  "watch": {
    "watch-preserve-output": true
  }
}

The configuration file supports namespace-specific options:

  • The nodeOptions field contains CLI flags that are allowed in NODE_OPTIONS.
  • Namespace fields like testRunner contain configuration specific to that subsystem.

No-op flags are not supported. Not all V8 flags are currently supported. It's possible to use the official JSON schema to validate the configuration file, which may vary depending on the Node.js version. Each key in the configuration file corresponds to a flag that can be passed as a command-line argument. The value of the key is the value that would be passed to the flag. For example, the configuration file above is equivalent to these command-line arguments:

node --import amaro/strip --watch-path=src --watch-preserve-output --test-isolation=process

The priority in configuration goes like this:

  1. NODE_OPTIONS and command-line options
  2. Dotenv NODE_OPTIONS
  3. Configuration file

Values in the configuration file will not override the values in the environment variables, command-line options, or the NODE_OPTIONS env file parsed by the --env-file flag. Keys cannot be duplicated within the same or different namespaces. The configuration parser will throw an error if the configuration file contains unknown keys or keys that cannot be used in a namespace.

โš ๏ธ Okay this part is IMPORTANT, bestie. Node.js will not sanitize or perform validation on the user-provided configuration, so NEVER use untrusted configuration files. Never ever. ๐Ÿšจ
  • --experimental-default-config-file โ€” this flag is an alias for --experimental-config-file without an argument. If present, Node.js will look for a node.config.json file in the current working directory and load it as a configuration file.
  • --experimental-import-meta-resolve โ€” enables experimental ES modules support for import.meta.resolve().
  • --experimental-import-text โ€” enables experimental support for importing modules with with { type: 'text' }.
  • *--experimental-loader=module* โ€” specify the module to use as a custom module loader.
  • --permission โ€” enables the permission model. ๐Ÿ”
  • --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-transform-types โ€” enables transformation of TypeScript-only syntax into JavaScript code.
  • --experimental-eventsource โ€” enables experimental support for the EventSource Web API.
  • --no-experimental-websocket โ€” disables experimental support for the WebSocket API.
  • --experimental-webstorage โ€” enables experimental support for the Web Storage API.
  • --no-experimental-repl-await โ€” disables top-level await keyword support in the REPL.
  • --no-experimental-sqlite โ€” disables the experimental node:sqlite module.
  • --no-require-module โ€” disables support for loading ECMAScript modules with require().
  • --no-strip-types โ€” disables type-stripping for TypeScript files.
  • --experimental-test-tag-filter tag โ€” run only tests whose tag set contains tag. It may be specified multiple times; tests must contain every filter to run.
  • --experimental-vm-modules โ€” enables experimental ES module support in the VM module.
  • --experimental-wasi-unstable-preview1 โ€” enables experimental WebAssembly System Interface support. This flag is no longer required as WASI is enabled by default. ๐ŸŒˆ
  • --experimental-quic โ€” enables the experimental QUIC support.
  • --experimental-inspector-network-resource โ€” enables experimental support for inspector network resources.
  • --experimental-storage-inspection โ€” enables experimental support for storage inspection.
  • --force-context-aware โ€” disables loading native addons that are not context-aware. ๐Ÿ’€
  • --force-fips โ€” forces FIPS-compliant crypto on startup (this cannot be disabled from script code). Same requirements as --enable-fips.
  • --frozen-intrinsics โ€” enables experimental frozen intrinsics support.
  • *--heapsnapshot-near-heap-limit=max_count* โ€” generates a heap snapshot when the V8 heap usage is approaching 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-dir isn't specified, the profile gets written to the current working directory with a generated file name. โœจ
  • --heap-prof-dir โ€” the directory where the heap profiles generated by --heap-prof will be placed. The default value is controlled by the --diagnostic-dir command-line option.
  • --heap-prof-interval โ€” the average sampling interval in bytes for the heap profiles generated by --heap-prof. The default is 512 * 1024.
  • --heap-prof-name โ€” file name of the V8 heap profile generated with --heap-prof.
  • *--icu-data-dir=file* โ€” specifies the ICU data load path. This overrides NODE_ICU_DATA. ๐Ÿ’œ

and that's where part 1 wraps, bestie โ€” but WE ARE NOT DONE, there's more coming ๐Ÿฆ‹

  • --input-type=type โ€” sets the module resolution type for input coming in via --eval, --print or STDIN. yes bestie, that's the vibe ๐Ÿ’…
  • --inspect-brk=[host:]port โ€” turns the inspector on at host:port and then breaks at the very start of your user script, so you get to peek before anything even happens ๐Ÿซถ
  • --inspect-port=[host:]port โ€” picks which host:port the inspector should live on when it gets activated.
  • --inspect-publish-uid=stderr,http โ€” controls how the inspector's WebSocket URL gets exposed. Valid values are stderr and http. Default is stderr,http โœจ
  • --inspect-wait=[host:]port โ€” turns the inspector on at host:port and then justโ€ฆ waits for a debugger to attach. no rush, take your time ๐Ÿฆ‹
  • --inspect=[host:]port โ€” turns the inspector on at host:port. Default is 127.0.0.1:9229 ๐Ÿ‘‘

So the whole V8 Inspector integration thing is what lets you attach Chrome DevTools and IDEs to Node.js instances for debugging and profiling. It uses the Chrome DevTools Protocol. iconic behavior, fr fr ๐Ÿ”ฅ

  • --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. avoid it. ๐Ÿ’€
  • --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. so don't get too attached bestie ๐Ÿ™ˆ

  • --localstorage-file=file โ€” the file used to store localStorage data.
  • --max-http-header-size=size โ€” specify the maximum size of HTTP headers in bytes. Defaults to 16 KiB. ๐Ÿ“
  • --max-old-space-size-percentage=percentage โ€” sets the maximum memory size of V8's old memory section as a percentage of available system memory. This flag takes precedence over --max-old-space-size when both are specified. The percentage parameter must be a number greater than 0 and up to 100, representing the percentage of available system memory to allocate to the V8 heap.
Note: This flag utilizes --max-old-space-size, which may be unreliable on 32-bit platforms due to integer overflow issues. ๐Ÿซ 
  • --napi-modules โ€” this option is a no-op. It is kept for compatibility. it's literally just standing there, being decorative ๐ŸŽ€
  • --no-deprecation โ€” silences deprecation warnings.
  • --no-extra-info-on-fatal-exception โ€” hides extra information on fatal exception that causes exit.
  • --no-force-async-hooks-checks โ€” disables runtime checks for async_hooks. These will still be enabled dynamically when async_hooks is enabled.
  • --no-addons โ€” disables the node-addons exports condition as well as disables loading native addons. When --no-addons is specified, calling process.dlopen or requiring a native C++ addon will fail and throw an exception. ๐Ÿšซ
  • --no-global-search-paths โ€” do not search modules from global paths.
  • --no-warnings โ€” silences all process warnings (including deprecations). blessed silence ๐ŸŽง
  • --node-memory-debug โ€” enables extra debug checks for memory leaks in Node.js internals. This is usually only useful for developers debugging Node.js itself. iykyk ๐Ÿงš
  • --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.
  • --preserve-symlinks โ€” instructs the module loader to preserve symbolic links when resolving and caching modules other than the main module.
  • --preserve-symlinks-main โ€” instructs the module loader to preserve symbolic links when resolving and caching the main module.
  • --prof โ€” generate V8 profiler output. go off ๐Ÿ“Š
  • --prof-process โ€” process V8 profiler output generated using the V8 option --prof.
  • --redirect-warnings=file โ€” write process warnings to the given file instead of printing to stderr.
  • --report-compact โ€” write diagnostic reports in a compact format, single-line JSON.
  • --report-dir, --report-directory โ€” location at which the diagnostic report will be generated. The file name may be an absolute path. If it is not, the default directory it will be written to is controlled by the --diagnostic-dir. command-line option.
  • --report-filename โ€” name of the file to which the diagnostic report will be written.
  • --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 leads to termination of the application. Useful to inspect various diagnostic data elements such as heap, stack, event loop state, resource consumption etc. to reason about the fatal error. detective mode fr ๐Ÿ”
  • --report-on-signal โ€” enables diagnostic report to be generated upon receiving the specified (or predefined) signal to the running Node.js process. Default signal is SIGUSR2.
  • --report-signal โ€” sets or resets the signal for diagnostic report generation (not supported on Windows). Default signal is SIGUSR2.
  • --report-uncaught-exception โ€” enables diagnostic report to be generated on un-caught exceptions. Useful when inspecting JavaScript stack in conjunction with native stack and other runtime environment data.
  • --secure-heap=n โ€” specify the size of the OpenSSL secure heap. Any value less than 2 disables the secure heap. The default is 0. The value must be a power of two. โœŒ๏ธ (power of two, bestie, not just any number)
  • --secure-heap-min=n โ€” specify the minimum allocation from the OpenSSL secure heap. The default is 2. The value must be a power of two.
  • --test โ€” starts the Node.js command line test runner. ๐Ÿงช
  • --test-concurrency โ€” the maximum number of test files that the test runner CLI will execute concurrently.
  • --test-coverage-branches=threshold โ€” require a minimum threshold for branch coverage (0 - 100).
  • --test-coverage-exclude โ€” a glob pattern that excludes matching files from the coverage report.
  • --test-coverage-functions=threshold โ€” require a minimum threshold for function coverage (0 - 100).
  • --test-coverage-include โ€” a glob pattern that only includes matching files in the coverage report.
  • --test-coverage-lines=threshold โ€” require a minimum threshold for line coverage (0 - 100).
  • --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. bye bestie ๐Ÿ‘‹
  • --test-global-setup โ€” specifies a module containing global setup and teardown functions for the test runner.
  • --test-isolation=mode โ€” configures the type of test isolation used in the test runner.
  • --test-name-pattern โ€” a regular expression that configures the test runner to only execute tests whose name matches the provided pattern.
  • --test-random-seed โ€” set the seed used to randomize test execution order. This applies to both test file execution order and queued tests within each file. Providing this flag enables randomization implicitly, even without --test-randomize. The value must be an integer between 0 and 4294967295. This flag cannot be used with --watch or --test-rerun-failures. ๐ŸŽฒ
  • --test-randomize โ€” randomize test execution order. This applies to both test file execution order and queued tests within each file. This can help detect tests that rely on shared state or execution order. The seed used for randomization is printed in the test summary and can be reused with --test-random-seed. This flag cannot be used with --watch or --test-rerun-failures. ๐ŸŒ€
  • --test-reporter โ€” a test reporter to use when running tests.
  • --test-reporter-destination โ€” the destination for the corresponding test reporter.
  • --test-rerun-failures โ€” configures the tests runner to persist the state of tests to allow rerunning only failed tests.
  • --test-only โ€” configures the test runner to only execute top level tests that have the only option set.
  • --test-shard โ€” test suite shard to execute in a format of <index>/<total>.
  • --test-skip-pattern โ€” a regular expression that configures the test runner to skip tests whose name matches the provided pattern.
  • --test-timeout โ€” a number of milliseconds the test execution will fail after. โฐ
  • --test-update-snapshots โ€” regenerates the snapshot file used by the test runner for snapshot testing.
  • --throw-deprecation โ€” throw errors for deprecations. no gentle warnings here, we're throwing hands ๐ŸฅŠ
  • --title=title โ€” specify process.title on 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 NSS SSLKEYLOGFILE format and can be used by software (such as Wireshark) to decrypt the TLS traffic. ๐Ÿ”“
  • --tls-max-v1.2 โ€” set default maxVersion to 'TLSv1.2'. Use to disable support for TLSv1.3.
  • --tls-max-v1.3 โ€” set default maxVersion to 'TLSv1.3'. Use to enable support for TLSv1.3.
  • --tls-min-v1.0 โ€” set default minVersion to 'TLSv1'. Use for compatibility with old TLS clients or servers.
  • --tls-min-v1.1 โ€” set default minVersion to 'TLSv1.1'. Use for compatibility with old TLS clients or servers.
  • --tls-min-v1.2 โ€” set default minVersion to '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 default minVersion to 'TLSv1.3'. Use to disable support for TLSv1.2 in favour of TLSv1.3, which is more secure. โœจ
  • --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 โ€” okay so bestie, this is the template string that says where your trace event data filepath should live. It supports ${rotation} and ${pid} and that's the whole vibe. โœจ
  • --trace-events-enabled โ€” turn on the collection of trace event tracing information. Basically: let the tracing girlies gather their data. ๐Ÿ’…
  • --trace-exit โ€” prints a stack trace whenever an environment is exited proactively, i.e. invoking process.exit(). No cap, it's giving โ€œwho left the function without saying bye?โ€ ๐Ÿ˜ญ
  • --trace-sigint โ€” prints a stack trace on SIGINT. So when Ctrl+C shows up, you get the receipts. ๐Ÿ”ฅ
  • --trace-sync-io โ€” print a stack trace whenever synchronous I/O is detected after the first turn of the event loop. It's the โ€œnot me checking for blocking I/Oโ€ flag, fr fr. ๐Ÿ™ˆ
  • --trace-tls โ€” prints TLS packet trace information to stderr. Secure gossip, but make it packet-level. ๐ŸŽ€
  • --trace-uncaught โ€” print stack traces for uncaught exceptions; usually, the stack trace associated with the creation of an Error is printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be an Error instance). Iconic extra detail, honestly.
Careful bestie: enabling this option may affect garbage collection behavior negatively. ๐Ÿ’€
  • --trace-warnings โ€” print stack traces for process warnings (including deprecations). So every little โ€œhey maybe don't do thatโ€ gets a full backstory. ๐Ÿ‘‘
  • --track-heap-objects โ€” track heap object allocations for heap snapshots. Heap snooping, but make it forensic. ๐Ÿฆ‹
  • --unhandled-rejections=mode โ€” define the behavior for unhandled rejections, bestie. Can be one of strict (raise an error), warn (enforce warnings) or none (silence warnings). Pick your fighter. ๐Ÿ’–
  • --use-bundled-ca, --use-openssl-ca โ€” use bundled Mozilla CA store as supplied by 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 Mozilla CA store that is fixed at release time. It is identical on all supported platforms. Using 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. 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. Certified CA lore, no cap. ๐ŸŽ€
  • --use-env-proxy โ€” parse proxy settings from HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables and apply the setting in global HTTP/HTTPS clients. It's giving โ€œthe environment said so, so we did it.โ€ โœจ
  • --use-system-ca โ€” use the trusted CA certificates present in the system store, in addition to the certificates in the bundled Mozilla CA store and certificates from NODE_EXTRA_CA_CERTS. On Windows and macOS, it uses system APIs to integrate additional trusted certificates. On other platforms it is similar to --use-openssl-ca with the difference being that it caches the certificates on first load, and the system certificates are added in a complementary manner without replacing certificates from other sources. This flag supersedes --use-openssl-ca. Main character CA energy, honestly. ๐Ÿ‘‘
  • --use-largepages=mode โ€” re-map the Node.js static code to large memory pages at startup. If 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. 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). Big pages, big feels. ๐Ÿ’…
  • --v8-options โ€” print V8 command-line options. It's the V8 menu, bestie. ๐Ÿ“
  • --v8-pool-size=num โ€” set V8's thread pool size which will be used to allocate background jobs. If set to 0 then 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. So, like, don't fight the max. ๐Ÿ˜ญ
  • --watch โ€” starts Node.js in watch mode. When in watch mode, changes in the watched files cause the Node.js process to restart. By default, watch mode will watch the entry point and any required or imported module. Use --watch-path to specify what paths to watch. Restart era. ๐Ÿ”ฅ
  • --watch-path โ€” starts Node.js in watch mode and specifies what paths to watch. When in watch mode, changes in the watched paths cause the Node.js process to restart. This will turn off watching of required or imported modules, even when used in combination with --watch. So it's giving โ€œI said what I said, watch only this.โ€ ๐Ÿ’€
  • --watch-kill-signal โ€” customizes the signal sent to the process on watch mode restarts. Choose your own restart drama. ๐ŸŽ€
  • --zero-fill-buffers โ€” automatically zero-fills all newly allocated Buffer and SlowBuffer instances. Clean slate, zero crumbs, periodt. โœจ
  • -c, --check โ€” check the script's syntax without executing it. Exits with an error code if script is invalid. It's the vibe check before the actual run. ๐Ÿ‘‘
  • -e, --eval string โ€” evaluate string as JavaScript. Just run the little snippet, bestie. ๐Ÿ’…
  • -h, --help โ€” print command-line options. The output of this option is less detailed than this document. So this manual is the deluxe edition, iykyk. ๐Ÿ“š
  • -i, --interactive โ€” open the REPL even if stdin does not appear to be a terminal. Forced interactive mode, no questions asked. ๐Ÿฆ‹
  • -p, --print string โ€” identical to -e, but prints the result. Evaluate, then spill the tea. โ˜•
  • -r, --require module โ€” preload the specified module at startup. Follows require()'s module resolution rules. module may be either a path to a file, or a Node.js module name. Preload before the main character enters. ๐ŸŒŸ
  • -v, --version โ€” print node's version. Short, sweet, iconic. ๐Ÿ‘‘

๐ŸŒˆ ENVIRONMENT ๐ŸŒˆ

okay bestie, this is the part where we meet all the environment variables, aka the little gremlins hanging out in your shell that Node.js reads and obeys. they are literally so powerful. respect them. ๐Ÿ’–

  • FORCE_COLOR โ€” flips on ANSI colorized output โœจ. the value can be 1, true, or an empty string to say "gimme 16-color support", 2 for 256-color support, or 3 for 16 million-color support (rich girl behavior ๐Ÿ’…). when it's set to one of those supported values, it flat-out ignores both NO_COLOR and NODE_DISABLE_COLORS, no cap. any other value? colorized output gets disabled. bye.
  • NO_COLOR โ€” literally just an alias for NODE_DISABLE_COLORS. same girl, different name ๐Ÿซถ
  • NODE_COMPILE_CACHE dir โ€” turns on the module compile cache for the Node.js instance.
  • NODE_COMPILE_CACHE_PORTABLE โ€” when you set it to '1' or 'true', the module compile cache gets hit as long as the location of the modules relative to the cache directory stays consistent. pair it with NODE_COMPILE_CACHE to get portable on-disk caching ๐Ÿ”ฅ
  • NODE_DEBUG modules... โ€” a comma-separated list of core modules that should print debug info. nosy-on-purpose, we love that.
  • NODE_DEBUG_NATIVE modules... โ€” same vibe, but it's a comma-separated list of C++ core modules that should print debug information.
  • NODE_DISABLE_COMPILE_CACHE โ€” disables the module compile cache for the Node.js instance. rude but valid.
  • NODE_DISABLE_COLORS โ€” when set to 1, colors will not be used in the REPL. default to colorless, we respect the choice ๐Ÿ’€
  • NODE_EXTRA_CA_CERTS file โ€” set this and the well-known "root" CAs (like VeriSign) get extended with the extra certificates 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. lowkey lenient.

this environment variable is 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 absolutely nothing to the current process. it's giving "that ship has sailed" ๐Ÿฆ‹

  • NODE_ICU_DATA file โ€” data path for ICU (that's the Intl object) data. it will extend linked-in data when compiled with small-icu support.
  • NODE_NO_WARNINGS โ€” when set to 1, process warnings are silenced. shhh ๐Ÿคซ
  • NODE_OPTIONS options... โ€” a space-separated list of command-line options, interpreted as if they had been specified on the command line before the actual command (so the real ones can override them). Node.js will exit with an error if an option that isn't allowed in the environment gets used, like --print or a script file. so don't try it ๐Ÿ™ˆ
  • NODE_PATH directories... โ€” a colon-separated list of directories prefixed to the module search path.
  • NODE_PENDING_DEPRECATION โ€” when set to 1, emit pending deprecation warnings. the ghosts of APIs past โœจ
  • NODE_PENDING_PIPE_INSTANCES โ€” sets the number of pending pipe instance handles when the pipe server is waiting for connections. heads up: this setting applies to Windows only ๐ŸชŸ
  • NODE_PRESERVE_SYMLINKS โ€” when set to 1, the module loader preserves symbolic links when resolving and caching modules. no breaking the links, bestie ๐Ÿ”—
  • NODE_REDIRECT_WARNINGS file โ€” write process warnings to the given file instead of printing to stderr. it's equivalent to passing --redirect-warnings file on the command line. same energy, different outfit.
  • NODE_REPL_HISTORY file โ€” path to the file used to store persistent REPL history. the default path is ~/.node_repl_history, which this variable overrides. setting the value to an empty string ("" or " ") disables persistent REPL history entirely. rip to your past commands ๐ŸŽ€
  • NODE_REPL_EXTERNAL_MODULE file โ€” path to a Node.js module that gets loaded in place of the built-in REPL. overriding this value to an empty string ('') will use the built-in REPL. we're back to default, iconic.
  • NODE_SKIP_PLATFORM_CHECK โ€” when set to 1, the check for a supported platform is skipped during Node.js startup. Node.js might not execute correctly. any issues you hit on unsupported platforms will not be fixed. so likeโ€ฆ proceed at your own risk, queen ๐Ÿ’€
  • NODE_TEST_CONTEXT โ€” when set to 'child', test reporter options get overridden and test output is sent to stdout in the TAP format. if you pass any other value, Node.js makes no guarantees about the reporter format used or its stability. chaos, but make it documented ๐ŸŒธ
  • NODE_TLS_REJECT_UNAUTHORIZED โ€” when set to 0, TLS certificate validation is disabled. extreme. dramatic. please be careful.
  • NODE_USE_ENV_PROXY โ€” when enabled, Node.js parses the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables during startup, and tunnels requests over the specified proxy. currently this only affects requests sent over fetch(). support for other built-in http and https methods is under way โ€” the rest is coming, bestie, be patient ๐Ÿฆ‹
  • NODE_USE_SYSTEM_CA โ€” similar to --use-system-ca. it uses the trusted CA certificates present in the system store, in addition to the certificates in the bundled Mozilla CA store and certificates from NODE_EXTRA_CA_CERTS. more trust, more friends ๐Ÿ’–
  • NODE_V8_COVERAGE dir โ€” when set, Node.js writes JavaScript code coverage information to dir.
  • OPENSSL_CONF file โ€” load an OpenSSL configuration file on startup. among other uses, this can enable FIPS-compliant crypto if Node.js is built with ./configure --openssl-fips. heads up though: if the --openssl-config command-line option is used, this environment variable is ignored. command line wins, always ๐Ÿ’…
  • SSL_CERT_DIR dir โ€” if --use-openssl-ca is enabled, this overrides and sets OpenSSL's directory containing trusted certificates.
  • SSL_CERT_FILE file โ€” if --use-openssl-ca is enabled, this overrides and sets OpenSSL's file containing trusted certificates.
  • TZ โ€” specify the timezone configuration. time is a construct anyway โญ
  • UV_THREADPOOL_SIZE size โ€” sets the number of threads used in libuv's threadpool to size. threadpool glow-up, slay.

๐Ÿ› BUGS ๐Ÿ›

bugs are tracked in GitHub Issues: https://github.com/nodejs/node/issues โ€” go report them, bestie, that's how software grows ๐Ÿ’–


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 ๐Ÿ‘€


and that's a wrap on the whole NODE(1) page, bestie!! ๐ŸŽ€ this is the Node.js manual, and the footer stamps it with 2018 and the NODE(1) label โ€” so consider yourself fully caught up. go forth and node responsibly ๐Ÿซถโœจ๐Ÿ’–

๐Ÿ“ฆ where this page comes from