@@ -961,16 +961,35 @@ When set to `1`, process warnings are silenced.
961
961
added: v8.0.0
962
962
-->
963
963
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.
968
969
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:
971
972
972
973
``` 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"
974
993
```
975
994
976
995
Node.js options that are allowed are:
0 commit comments