Skip to content

fix(cli): add managed bin to hook path#1647

Merged
fengmk2 merged 3 commits into
mainfrom
fix/hook-managed-node-path
May 21, 2026
Merged

fix(cli): add managed bin to hook path#1647
fengmk2 merged 3 commits into
mainfrom
fix/hook-managed-node-path

Conversation

@TheAlexLichter
Copy link
Copy Markdown
Member

@TheAlexLichter TheAlexLichter commented May 20, 2026

When committing via VS Code on MacOS I hit the error

./node_modules/.bin/vp: line 20: exec: node: not found
VITE+ - pre-commit script failed (code 127)
VITE+ - command not found in PATH=./node_modules/.bin:/Library/Developer/CommandLineTools/usr/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin

But node was installed and vp env doctor was happy.
The issues seemed that the managed Node is not available in the Git hook.

I learned that Git hooks often run with a much smaller, non-interactive PATH, possibly not including the shims.
In my case, path was limited to what is shared in the error above. That included the local vp bin but not node, leading to the error.

The PR fixes that by making generated hooks add Vite+’s managed bin directory before running the user hook. Then vp staged can start even when Git launches the hook with a restricted PATH.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit fdd0e1f
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a0ec300a06bdc0008060a5f

@TheAlexLichter TheAlexLichter force-pushed the fix/hook-managed-node-path branch from 05e3832 to 66db44e Compare May 20, 2026 19:35
@TheAlexLichter TheAlexLichter marked this pull request as ready for review May 20, 2026 19:42
@TheAlexLichter TheAlexLichter requested a review from fengmk2 May 20, 2026 19:42
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented May 21, 2026

@codex review

Copy link
Copy Markdown
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

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

@TheAlexLichter Thanks! 💯

Copy link
Copy Markdown

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

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: 66db44e7e1

ℹ️ 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".

Comment thread packages/cli/src/config/hooks.ts Outdated
Comment thread packages/cli/src/config/hooks.ts Outdated
Comment thread packages/cli/src/config/hooks.ts Outdated
@TheAlexLichter TheAlexLichter force-pushed the fix/hook-managed-node-path branch from 6456bf4 to fbba442 Compare May 21, 2026 08:26
@TheAlexLichter TheAlexLichter force-pushed the fix/hook-managed-node-path branch from fbba442 to fdd0e1f Compare May 21, 2026 08:31
@TheAlexLichter TheAlexLichter requested a review from fengmk2 May 21, 2026 09:05
@fengmk2 fengmk2 merged commit 43cb59e into main May 21, 2026
39 checks passed
@fengmk2 fengmk2 deleted the fix/hook-managed-node-path branch May 21, 2026 11:27
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.

2 participants