Skip to content

Commit

Permalink
doc: describe NODE_OPTIONS interop w/cmd line opts
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
reasonablytall authored and BridgeAR committed Aug 6, 2019
1 parent 0f8f552 commit bdd442f
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -961,16 +961,35 @@ When set to `1`, process warnings are silenced.
added: v8.0.0
-->

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

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

```bash
--require "./my path/file.js"
NODE_OPTIONS='--require "./my path/file.js"'
```

A singleton flag passed as a command line option will override the same flag
passed into `NODE_OPTIONS`:

```bash
# The inspector will be available on port 5555
NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555
```

A flag that can be passed multiple times will be treated as if its
`NODE_OPTIONS` instances were passed first, and then its command line
instances afterwards:

```bash
NODE_OPTIONS='--require "./a.js"' node --require "./b.js"
# is equivalent to:
node --require "./a.js" --require "./b.js"
```

Node.js options that are allowed are:
Expand Down

0 comments on commit bdd442f

Please sign in to comment.