Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bdd442f

Browse filesBrowse files
reasonablytallBridgeAR
authored andcommitted
doc: describe NODE_OPTIONS interop w/cmd line opts
Fixes #28910 PR-URL: #28928 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 0f8f552 commit bdd442f
Copy full SHA for bdd442f

File tree

Expand file treeCollapse file tree

1 file changed

+26
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+26-7Lines changed: 26 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -961,16 +961,35 @@ When set to `1`, process warnings are silenced.
961961
added: v8.0.0
962962
-->
963963

964-
A space-separated list of command line options. `options...` are interpreted as
965-
if they had been specified on the command line before the actual command line
966-
(so they can be overridden). Node.js will exit with an error if an option
967-
that is not allowed in the environment is used, such as `-p` or a script file.
964+
A space-separated list of command line options. `options...` are interpreted
965+
before command line options, so command line options will override or
966+
compound after anything in `options...`. Node.js will exit with an error if
967+
an option that is not allowed in the environment is used, such as `-p` or a
968+
script file.
968969

969-
In case an option value happens to contain a space (for example a path listed in
970-
`--require`), it must be escaped using double quotes. For example:
970+
In case an option value happens to contain a space (for example a path listed
971+
in `--require`), it must be escaped using double quotes. For example:
971972

972973
```bash
973-
--require "./my path/file.js"
974+
NODE_OPTIONS='--require "./my path/file.js"'
975+
```
976+
977+
A singleton flag passed as a command line option will override the same flag
978+
passed into `NODE_OPTIONS`:
979+
980+
```bash
981+
# The inspector will be available on port 5555
982+
NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555
983+
```
984+
985+
A flag that can be passed multiple times will be treated as if its
986+
`NODE_OPTIONS` instances were passed first, and then its command line
987+
instances afterwards:
988+
989+
```bash
990+
NODE_OPTIONS='--require "./a.js"' node --require "./b.js"
991+
# is equivalent to:
992+
node --require "./a.js" --require "./b.js"
974993
```
975994

976995
Node.js options that are allowed are:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.