Skip to content

fix: prepend node_modules/.bin to PATH for npm/npx execution#906

Merged
loonghao merged 2 commits into
mainfrom
fix/npm-node-modules-bin-path
May 25, 2026
Merged

fix: prepend node_modules/.bin to PATH for npm/npx execution#906
loonghao merged 2 commits into
mainfrom
fix/npm-node-modules-bin-path

Conversation

@loonghao
Copy link
Copy Markdown
Owner

Summary

  • When vx npm run <script> executes on Windows, npm's internal PATH prepend for node_modules/.bin can fail when the env is set explicitly via Command::env(), causing locally-installed binaries (tsc, vite, etc.) to not be found.
  • This adds a defensive safety net: vx now prepends the local node_modules/.bin directory to PATH when executing npm or npx commands (only when the directory exists).
  • Fixes the 'tsc' is not recognized error in dcc-mcp-core's build.rs when running vx npm run build.

Test plan

  • All 3679 existing tests pass (cargo nextest run --workspace)
  • cargo clippy --workspace -- -D warnings passes with zero warnings
  • cargo fmt --all -- --check passes
  • CI passes on this PR
  • Verify fix in dcc-mcp-core: vx just dev completes without tsc not found error

🤖 Generated with Claude Code

loonghao and others added 2 commits May 26, 2026 01:45
When `vx npm run <script>` is called on Windows, npm's internal PATH
prepend (adding node_modules/.bin for script execution) can fail when
the environment is explicitly set via Command::env(). This causes
locally-installed binaries like tsc, vite, etc. to not be found.

As a defensive safety net, vx now prepends the local
node_modules/.bin directory to PATH when executing npm or npx
commands, mirroring what npm does internally. The directory is only
added if it actually exists on disk.

Fixes the "'tsc' is not recognized" error in dcc-mcp-core's build.rs
when running `vx npm run build` from the admin-ui/ directory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@loonghao loonghao merged commit ef82a93 into main May 25, 2026
18 checks passed
@loonghao loonghao deleted the fix/npm-node-modules-bin-path branch May 25, 2026 18:28
loonghao added a commit that referenced this pull request May 26, 2026
* fix: prepend node_modules/.bin to PATH for npm/npx execution

When `vx npm run <script>` is called on Windows, npm's internal PATH
prepend (adding node_modules/.bin for script execution) can fail when
the environment is explicitly set via Command::env(). This causes
locally-installed binaries like tsc, vite, etc. to not be found.

As a defensive safety net, vx now prepends the local
node_modules/.bin directory to PATH when executing npm or npx
commands, mirroring what npm does internally. The directory is only
added if it actually exists on disk.

Fixes the "'tsc' is not recognized" error in dcc-mcp-core's build.rs
when running `vx npm run build` from the admin-ui/ directory.


* chore: regenerate workspace-hack (cargo-hakari) [skip ci]

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
loonghao added a commit that referenced this pull request May 26, 2026
* fix: prepend node_modules/.bin to PATH for npm/npx execution

When `vx npm run <script>` is called on Windows, npm's internal PATH
prepend (adding node_modules/.bin for script execution) can fail when
the environment is explicitly set via Command::env(). This causes
locally-installed binaries like tsc, vite, etc. to not be found.

As a defensive safety net, vx now prepends the local
node_modules/.bin directory to PATH when executing npm or npx
commands, mirroring what npm does internally. The directory is only
added if it actually exists on disk.

Fixes the "'tsc' is not recognized" error in dcc-mcp-core's build.rs
when running `vx npm run build` from the admin-ui/ directory.


* chore: regenerate workspace-hack (cargo-hakari) [skip ci]
This was referenced May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant