Skip to content

fix(cli): move the selected managed Node.js to the front of PATH - #3591

Open
naokihaba wants to merge 3 commits into
voidzero-dev:mainfrom
naokihaba:fix/managed-node-path-precedence
Open

naokihaba wants to merge 3 commits into
voidzero-dev:mainfrom
naokihaba:fix/managed-node-path-precedence

Conversation

@naokihaba

@naokihaba naokihaba commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Context

As reported in #3492, when a project uses Node.js 26 in managed mode and PATH already lists Node.js 24 before Node.js 26, vp install ends up running engine checks and lifecycle scripts with Node.js 24 instead of 26.

Without this fix, users have to manually tweak their PATH or specify the version every time, for example by running vp env exec --node 26.13.1 -- pnpm install. Otherwise, they might not even realize that these checks and scripts are silently running on the older version.

This happens because vp install prepends the selected bin directory using the dedupe_anywhere: true option. Under this setting, any directory already present in PATH just keeps its existing spot. Since Node.js 26 was already listed after Node.js 24, it stayed behind, so looking up node still resolved to Node.js 24.

This PR makes sure the selected bin directory is always moved to the front of PATH for managed runtimes. We left the behavior untouched for system-first mode, though, so we don't accidentally prioritize unrelated tools that might live in system directories.

I'll look into the discussion in #3591 (comment) in #3592.

`vp install` prepended the selected Node.js bin directory with
`dedupe_anywhere: true`. When that directory was already on PATH after
another Node.js, it kept its position, so pnpm, engine checks, and
lifecycle scripts used the other Node.js.

Keep the existing position only for a system Node.js selected in
system-first mode. Move a managed runtime to the front.

Fixes voidzero-dev#3492
@naokihaba

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T06:02:20.947385Z ead2720 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@liangmiQwQ
liangmiQwQ self-requested a review November 28, 2026 05:40
@naokihaba
naokihaba removed the request for review from liangmiQwQ November 28, 2026 05:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffd83ba52c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@naokihaba

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: ead2720a82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@naokihaba
naokihaba marked this pull request as ready for review November 28, 2026 06:02
@naokihaba
naokihaba requested a review from fengmk2 November 28, 2026 06:03

This branch has not been deployed

No deployments
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.

Managed Node.js loses PATH precedence during vp install

1 participant