Skip to content

doc: NODE_OPTIONS description is ambiguous/confusing #28910

Closed

Description

@reasonablytall

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.

To me that "(so they can be overridden)" part is ambiguous. Do the command line options override the environment NODE_OPTIONS, or vice versa?

I would be happy to make a quick PR myself, but I don't actually know the semantics, so I'm making this quick issue.

https://nodejs.org/api/cli.html#cli_node_options_options

Activity

  1. Trott commented on Aug 1, 2019

    @Trott
    Member

    The CLI flag overrides the NODE_OPTIONS value. PR away!

  2. Trott commented on Aug 1, 2019

    @Trott
    Member

    Quick demo that the CLI flag overrides NODE_OPTIONS:

    $ node --inspect=localhost:5555
    Debugger listening on ws://localhost:5555/6b7727a2-c795-451a-b36a-d56ae4edcafb
    Debugger listening on ws://localhost:5555/6b7727a2-c795-451a-b36a-d56ae4edcafb
    For help, see: https://nodejs.org/en/docs/inspector
    Welcome to Node.js v12.7.0.
    Type ".help" for more information.
    > 
    $ NODE_OPTIONS='--inspect=localhost:4444' node
    Debugger listening on ws://localhost:4444/a80e0061-7300-4ff7-8544-b68d24daa0bd
    Debugger listening on ws://localhost:4444/a80e0061-7300-4ff7-8544-b68d24daa0bd
    For help, see: https://nodejs.org/en/docs/inspector
    Welcome to Node.js v12.7.0.
    Type ".help" for more information.
    > 
    $ NODE_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555
    Debugger listening on ws://localhost:5555/03f8aa25-bf48-4e81-bbeb-b25f52c2c58d
    Debugger listening on ws://localhost:5555/03f8aa25-bf48-4e81-bbeb-b25f52c2c58d
    For help, see: https://nodejs.org/en/docs/inspector
    Welcome to Node.js v12.7.0.
    Type ".help" for more information.
    > 
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions