|
| 1 | +# Command Line Options |
| 2 | + |
| 3 | +<!--type=misc--> |
| 4 | + |
| 5 | +Node.js comes with a wide variety of CLI options. These options expose built-in |
| 6 | +debugging, multiple ways to execute scripts, and other helpful runtime options. |
| 7 | + |
| 8 | +To view this documentation as a manual page in your terminal, run `man node`. |
| 9 | + |
| 10 | + |
| 11 | +## Synopsis |
| 12 | + |
| 13 | +`node [options] [v8 options] [script.js | -e "script"] [arguments]` |
| 14 | + |
| 15 | +`node debug [script.js | -e "script" | <host>:<port>] …` |
| 16 | + |
| 17 | +`node --v8-options` |
| 18 | + |
| 19 | +Execute without arguments to start the [REPL][]. |
| 20 | + |
| 21 | +_For more info about `node debug`, please see the [debugger][] documentation._ |
| 22 | + |
| 23 | + |
| 24 | +## Options |
| 25 | + |
| 26 | +### `-v`, `--version` |
| 27 | + |
| 28 | +Print node's version. |
| 29 | + |
| 30 | + |
| 31 | +### `-h`, `--help` |
| 32 | + |
| 33 | +Print node command line options. |
| 34 | +The output of this option is less detailed than this document. |
| 35 | + |
| 36 | + |
| 37 | +### `-e`, `--eval "script"` |
| 38 | + |
| 39 | +Evaluate the following argument as JavaScript. |
| 40 | + |
| 41 | + |
| 42 | +### `-p`, `--print "script"` |
| 43 | + |
| 44 | +Identical to `-e` but prints the result. |
| 45 | + |
| 46 | + |
| 47 | +### `-c`, `--check` |
| 48 | + |
| 49 | +Syntax check the script without executing. |
| 50 | + |
| 51 | + |
| 52 | +### `-i`, `--interactive` |
| 53 | + |
| 54 | +Opens the REPL even if stdin does not appear to be a terminal. |
| 55 | + |
| 56 | + |
| 57 | +### `-r`, `--require module` |
| 58 | + |
| 59 | +Preload the specified module at startup. |
| 60 | + |
| 61 | +Follows `require()`'s module resolution |
| 62 | +rules. `module` may be either a path to a file, or a node module name. |
| 63 | + |
| 64 | + |
| 65 | +### `--no-deprecation` |
| 66 | + |
| 67 | +Silence deprecation warnings. |
| 68 | + |
| 69 | + |
| 70 | +### `--trace-deprecation` |
| 71 | + |
| 72 | +Print stack traces for deprecations. |
| 73 | + |
| 74 | + |
| 75 | +### `--throw-deprecation` |
| 76 | + |
| 77 | +Throw errors for deprecations. |
| 78 | + |
| 79 | + |
| 80 | +### `--trace-sync-io` |
| 81 | + |
| 82 | +Prints a stack trace whenever synchronous I/O is detected after the first turn |
| 83 | +of the event loop. |
| 84 | + |
| 85 | + |
| 86 | +### `--zero-fill-buffers` |
| 87 | + |
| 88 | +Automatically zero-fills all newly allocated [Buffer][] and [SlowBuffer][] |
| 89 | +instances. |
| 90 | + |
| 91 | + |
| 92 | +### `--track-heap-objects` |
| 93 | + |
| 94 | +Track heap object allocations for heap snapshots. |
| 95 | + |
| 96 | + |
| 97 | +### `--prof-process` |
| 98 | + |
| 99 | +Process v8 profiler output generated using the v8 option `--prof`. |
| 100 | + |
| 101 | + |
| 102 | +### `--v8-options` |
| 103 | + |
| 104 | +Print v8 command line options. |
| 105 | + |
| 106 | + |
| 107 | +### `--tls-cipher-list=list` |
| 108 | + |
| 109 | +Specify an alternative default TLS cipher list. (Requires Node.js to be built |
| 110 | +with crypto support. (Default)) |
| 111 | + |
| 112 | + |
| 113 | +### `--enable-fips` |
| 114 | + |
| 115 | +Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with |
| 116 | +`./configure --openssl-fips`) |
| 117 | + |
| 118 | + |
| 119 | +### `--force-fips` |
| 120 | + |
| 121 | +Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) |
| 122 | +(Same requirements as `--enable-fips`) |
| 123 | + |
| 124 | + |
| 125 | +### `--icu-data-dir=file` |
| 126 | + |
| 127 | +Specify ICU data load path. (overrides `NODE_ICU_DATA`) |
| 128 | + |
| 129 | + |
| 130 | +## Environment Variables |
| 131 | + |
| 132 | +### `NODE_DEBUG=module[,…]` |
| 133 | + |
| 134 | +`','`-separated list of core modules that should print debug information. |
| 135 | + |
| 136 | + |
| 137 | +### `NODE_PATH=path[:…]` |
| 138 | + |
| 139 | +`':'`-separated list of directories prefixed to the module search path. |
| 140 | + |
| 141 | +_Note: on Windows, this is a `';'`-separated list instead._ |
| 142 | + |
| 143 | + |
| 144 | +### `NODE_DISABLE_COLORS=1` |
| 145 | + |
| 146 | +When set to `1` colors will not be used in the REPL. |
| 147 | + |
| 148 | + |
| 149 | +### `NODE_ICU_DATA=file` |
| 150 | + |
| 151 | +Data path for ICU (Intl object) data. Will extend linked-in data when compiled |
| 152 | +with small-icu support. |
| 153 | + |
| 154 | + |
| 155 | +### `NODE_REPL_HISTORY=file` |
| 156 | + |
| 157 | +Path to the file used to store the persistent REPL history. The default path is |
| 158 | +`~/.node_repl_history`, which is overridden by this variable. Setting the value |
| 159 | +to an empty string (`""` or `" "`) disables persistent REPL history. |
| 160 | + |
| 161 | + |
| 162 | +[Buffer]: buffer.html#buffer_buffer |
| 163 | +[debugger]: debugger.html |
| 164 | +[REPL]: repl.html |
| 165 | +[SlowBuffer]: buffer.html#buffer_class_slowbuffer |
0 commit comments