ProxymanApp / ProxymanApp/Proxyman

--r not allowed in NODE_OPTIONS

Open
#2,552 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

✅ Done bug
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Bug Report: Invalid NODE_OPTIONS format causes Node.js startup failure

Environment

  • Proxyman Version: 5.11.0
  • OS: macOS (darwin 24.5.0)
  • Node.js Version: v22.19.0
  • Shell: zsh

Problem Description

When Proxyman's automatic setup script injects environment variables, it sets NODE_OPTIONS with escaped quotes around the file path, which causes Node.js to fail with the error:

/usr/local/bin/node: --r= is not allowed in NODE_OPTIONS

This prevents any Node.js application (including npm run dev, npm start, etc.) from starting when Proxyman's terminal injection is active.

Steps to Reproduce

  1. Enable Proxyman's automatic terminal injection
  2. Open a new terminal or run Proxyman's setup script:
    set -a && source "/Users/hiteshmac/.proxyman/proxyman_env_automatic_setup.sh" && set +a
    
  3. Attempt to run any Node.js command:
    npm run dev
    # or
    node --version
    # or
    npm start
    

Expected Behavior

Node.js should start normally with Proxyman's HTTP/HTTPS traffic interception enabled.

Actual Behavior

Node.js fails to start with the error:

/usr/local/bin/node: --r= is not allowed in NODE_OPTIONS

Root Cause

In /Users/hiteshmac/.proxyman/proxyman_env_automatic_setup.sh, line 11 contains:

export NODE_OPTIONS="--require \"/Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/overrides/js/js.min.js\""

The escaped quotes (\") around the file path cause Node.js to misinterpret the --require flag. Node.js expects the --require flag to be followed by a path without quotes (unless the path contains spaces, which this one doesn't).

When Node.js parses this, it appears to interpret the quotes as part of the argument, leading to the --r= error (possibly a truncated/parsed version of --require).

Current Workaround

Manually edit the Proxyman script to remove the inner quotes:

Before:

export NODE_OPTIONS="--require \"/Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/overrides/js/js.min.js\""

After:

export NODE_OPTIONS="--require /Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/overrides/js/js.min.js"

However, this workaround is temporary as Proxyman may regenerate the script, requiring manual fixes each time.

Proposed Fix

Remove the escaped quotes from the NODE_OPTIONS export in the Proxyman script generator. The --require flag in Node.js doesn't need quotes around the path unless the path contains spaces.

Location: The script generation code that creates proxyman_env_automatic_setup.sh

Change:

- export NODE_OPTIONS="--require \"/Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/overrides/js/js.min.js\""
+ export NODE_OPTIONS="--require /Applications/Proxyman.app/Contents/Frameworks/ProxymanCore.framework/Versions/A/Resources/overrides/js/js.min.js"

Additional Context

  • This affects all Node.js applications when Proxyman's terminal injection is enabled
  • The issue occurs regardless of Node.js version (tested on v22.19.0)
  • The .zshrc file also gets modified with the same incorrect format when Proxyman sets up terminal injection
  • Other environment variables in the script (like HTTP_PROXY, HTTPS_PROXY, etc.) work correctly

Verification

After applying the fix, verify with:

# Check NODE_OPTIONS value
echo $NODE_OPTIONS
# Should output: --require /Applications/Proxyman.app/.../js.min.js (without quotes)

# Test Node.js
node --version
# Should output: v22.19.0 (or your version)

# Test npm
npm run dev
# Should start the dev server successfully

Impact

Severity: High - This completely prevents Node.js applications from running when Proxyman terminal injection is enabled, making the feature unusable for Node.js developers.


Thank you for maintaining Proxyman! This is an excellent tool, and fixing this issue would greatly improve the developer experience.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the script-generation code that creates proxyman_env_automatic_setup.sh and the related .zshrc modification. Reproduce the generated NODE_OPTIONS value, then verify that node --version and npm run dev start successfully after regeneration without the escaped quotes.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, shell, zsh
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.