Session-start hook reports "The Vercel CLI is not installed" on Windows — execFileSync on vercel.cmd throws EINVAL
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, typescript
- Lĩnh vực
- tooling
Hướng nghiên cứu
Bắt đầu trong hooks/src/session-start-profiler.mts tại checkVercelCli và so sánh nó với hooks/session-start-profiler.mjs đang được chạy. Chạy bản tái hiện tối thiểu trên Windows và kiểm tra lệnh gọi npm view ở gần đó để tìm cùng một mẫu spawning. Hoàn tất khi các CLI .cmd và .bat được npm cài đặt trên Windows được phát hiện và hook session-start không còn báo một CLI đã cài đặt là bị thiếu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happened
On Windows the session-start hook always injects this into the agent's context:
IMPORTANT: The Vercel CLI is not installed.
Strongly recommend the user install it withnpm i -g vercelto unlock agentic features likevercel env pull,vercel deploy, andvercel logs.
The CLI is installed and authenticated:
$ vercel --version
Vercel CLI 56.5.0
$ vercel whoami
<my username>
The practical cost is not the wrong line, it's what the agent does with it: it takes the statement at face value and avoids vercel ls / vercel inspect for the rest of the session, so it can't check its own deployments.
Environment
- Plugin:
vercel0.48.0 (installed fromanthropics/claude-plugins-official) - OS: Windows 11
- Node: v24.13.0
vercelinstalled globally with npm, so it resolves to%APPDATA%\npm\vercel.cmd
Cause
In hooks/src/session-start-profiler.mts (and identically in the compiled hooks/session-start-profiler.mjs that actually runs):
checkVercelCli()(~line 416) resolves the binary correctly.resolveBinaryFromPathdoes append the Windows executable extensions and findsvercel.cmd, so this part is not the bug.- It then calls
execFileSync(vercelBinary, ["--version"])at ~line 425 withoutshell: true. - Since Node 18.20 / 20.12 (the CVE-2024-27980 hardening), spawning a
.cmdor.batwithout a shell throwsEINVAL. - The
catchat ~line 433 swallows it and returns{ installed: false }— which is what produces the message.
So the hook finds the CLI and then concludes it does not exist.
Minimal repro
node -e "const{execFileSync}=require('child_process');const p=require('path').join(process.env.APPDATA,'npm','vercel.cmd');try{execFileSync(p,['--version'],{stdio:['ignore','pipe','ignore']});console.log('ok')}catch(e){console.log(e.code)}"
Prints EINVAL. Adding shell: true (with the path quoted) makes it print ok.
Blast radius
- The
npm viewcall at ~line 449 has exactly the same shape and would fail the same way, but it is unreachable: thecatchon the first call returns before it. - The "CLI is outdated (x → y)" branch lives in the
elseofinstalled, so on Windows it can never fire. Windows users don't get a false statement there — they get no upgrade notice at all. - Any npm-installed CLI on Windows resolves to a
.cmdshim, so the pattern isn't specific tovercel.
Suggested fix
Spawn through a shell on Windows when the resolved path ends in .cmd / .bat, or resolve to the JS entry point behind the shim instead of the shim itself. A bare shell: true needs care with argument escaping, so quoting the resolved path explicitly is probably the safer form.
- Ngôn ngữ chính
- TypeScript
- Star
- 309
- Fork
- 68
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 113
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của vercel/vercel-plugin
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
vercel/vercel-plugin#313 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
vercel/vercel-plugin#312 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
vercel/vercel-plugin#311 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 78/100
vercel/vercel-plugin#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
vercel/vercel-plugin#182 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của vercel/vercel-plugin
Issue tương tự
-
[Android] Nested transforms are composed in reverse orderCó thể đã có người làm @Danyalo đã nhận hôm nay. Đang mởRepro provided
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
software-mansion/react-native-svg#3090 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
radix-ui/primitives#4228 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
rocketride-org/rocketride-server#2705 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
archon-ready archon-size-s archon-type-bug area: web
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
coleam00/Archon#4707 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
HarperFast/grafana-datasource#177 ·