Hook dispatcher breaks on Git for Windows when core.hooksPath is an absolute path
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 72/100
Direção de pesquisa
Start by reading the generated .vite-hooks/_/h script described in the issue, then locate the code that generates it and any related hook tests. Reproduce on Windows with Git for Windows using an absolute core.hooksPath. Done means the generated dispatcher handles that path correctly and git commit runs the repository's hook without the reported module error or silently falling back to a global vp.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Version: vite-plus 1.3.0 (global vp 1.2.0), Git for Windows 2.54.0, Node 22.23.1, Windows 11.
What happens
When core.hooksPath is an absolute Windows path such as C:\repo\.vite-hooks\_, every hook fails:
Error: Cannot find module 'C:\Program Files\Git\Users\me\repo\node_modules\vite-plus\bin\vp'
VITE+ - pre-commit script failed (code 1)
Some tools set an absolute path on purpose. For example, worktree managers point linked worktrees at the main checkout's dispatcher, because the generated .vite-hooks/_ is gitignored and missing in a new worktree.
Cause
The generated .vite-hooks/_/h derives the repo root from $0 and prepends it to PATH:
d="$(dirname "$(dirname "$(dirname "$0")")")"
export PATH="$d/node_modules/.bin:$PATH"
Git for Windows passes $0 as a drive-letter path, so d is C:\repo or C:/repo. sh splits the PATH entry at the drive colon into C and \repo\node_modules\.bin:
- With backslashes, sh finds the pnpm shim through the drive-relative path. The shim then passes
/repo/...to Node, which MSYS maps under the Git install root, giving the MODULE_NOT_FOUND above. - With forward slashes, the entry doesn't resolve, and
vpsilently falls back to whatever else is on PATH (here, the global~/.vite-plus/bin/vp).
Repro
- On Windows with Git for Windows, run
vp config --hooksin a repo whose pre-commit isvp staged. - Run
git config core.hooksPath "$(pwd -W)\.vite-hooks\_", or anyC:\...absolute value. - Run
git commit.
Suggested fix
Normalise d (or $0) to a POSIX path before building PATH, for example:
case "$d" in [A-Za-z]:*) command -v cygpath >/dev/null 2>&1 && d=$(cygpath -u "$d") ;; esac
Alternatively, avoid putting a path derived from $0 into PATH. Husky uses the cwd-relative node_modules/.bin.
Workaround we use (documented init script ~/.config/vite-plus/hooks-init.sh):
case "$0" in
[A-Za-z]:*)
if [ -z "${VP_HOOKS_POSIX_REEXEC-}" ] && command -v cygpath >/dev/null 2>&1; then
export VP_HOOKS_POSIX_REEXEC=1
exec sh "$(cygpath -u "$0")" "$@"
fi
;;
esac
- Linguagem predominante
- Rust
- Estrelas
- 6.5k
- Forks
- 296
- Merge médio
- 1d 2h
- PRs com merge (30d)
- 230
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/vite-plus
-
pending triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 63/100
voidzero-dev/vite-plus#3235 ·
Mantenedores costumam responder em até 1 dia
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterTalvez já em andamento @kshanxs assumiu há 5 dias. Abertadocumentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
voidzero-dev/vite-plus#3219 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
pending triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
voidzero-dev/vite-plus#2882 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
`vp create` doesn't rewrite `vite` imports when adding a third-party template to a monorepoTalvez já em andamento @voidzero-bot assumiu hoje. Aberta- P2: has workaround pending triage triage: fix verified
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
voidzero-dev/vite-plus#3281 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`npm install -g` keeps the `bin` link on the old version after the default Node.js changesTalvez já em andamento @mondaychen assumiu hoje. Abertabug triage: failed
voidzero-dev/vite-plus#3279 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/vite-plus
Issues semelhantes
-
area:cli bug dotnet good first issue priority:medium
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
rtk-ai/rtk#4844 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
delta-io/delta-kernel-rs#3757 ·
Mantenedores costumam responder em até 3 dias
-
area: library data-loss type: bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
alplabai/signex#1740 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
test(fslc): the unreadable mutate catalog test pins the Unix I/O error text and fails on WindowsTalvez já em andamento @rizumita assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 69/100
Mantenedores costumam responder em até 1 dia