Skip to content

Add --use-env-proxy to NODE_OPTIONSΒ #59100

Description

@silverwind

#57165 added the NODE_USE_ENV_PROXY environment variable, but the problem with such a variable is that it can not be controlled by the script itself via hashbang without writing into process.env which is dirty and not guaranteed to work depending on the implementation.

Therefor I suggest to also support it as a CLI flag --use-env-proxy and via NODE_OPTIONS=--use-env-proxy, enabling such hashbangs:

#!/usr/bin/env -S node --use-env-proxy

As for precedence, I suggest taking the value of NODE_USE_ENV_PROXY first if present, then fall back to --use-env-proxy.

Activity

  1. joyeecheung commented on Jul 21, 2025

    @joyeecheung
    Member

    As for precedence, I suggest taking the value of NODE_USE_ENV_PROXY first if present, then fall back to --use-env-proxy.

    For consistency, we should probably go with the other way around - this is what we do for several options like NODE_PENDING_DEPRECATION/--pending-deprecation, NODE_PRESERVE_SYMLINKS/--preserve-symlinks etc.

  2. silverwind commented on Jul 22, 2025

    @silverwind
    ContributorAuthor

    Right, stick to existing precedence.

  3. added a commit that references this issue on Jul 26, 2025
  4. added a commit that references this issue on Jul 27, 2025
  5. added a commit that references this issue on Oct 18, 2025
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