vercel / vercel/vercel-plugin

Windows: session-start-profiler falsely reports "Vercel CLI is not installed" (runs the bash launcher without a shell)

Open Beginner friendly
#105 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
287
Forks
58
Avg merge
1d 1h
Merged PRs (30d)
17

Description

Summary

On Windows, the SessionStart hook (hooks/session-start-profiler.mjscheckVercelCli()) reports "The Vercel CLI is not installed" on every session start, even when the CLI is installed globally and on PATH (vercel --version52.0.0).

Environment

  • OS: Windows 11
  • Node: v24.14.1, npm 11.11.0
  • Vercel CLI: 52.0.0, global install at C:\Users\<user>\AppData\Roaming\npm\ (contains vercel, vercel.cmd, vercel.ps1)
  • Plugin: vercel@0.43.0 (the bug is identical in 0.40.0)

Root cause

resolveBinaryFromPath("vercel") builds candidate names as ["", ".EXE", ".CMD", ...]bare name first (getBinaryPathCandidates, the ["", ...WINDOWS_EXECUTABLE_EXTENSIONS] order). So on Windows it returns the extensionless …\npm\vercel (the Unix shell launcher npm also drops in the bin dir) before vercel.cmd. checkVercelCli() then runs it with no shell:

execFileSync(vercelBinary, VERCEL_VERSION_ARGS, { /* ... */ stdio: SPAWN_STDIO })

execFileSync without a shell cannot execute a shell script (nor a .cmd) on Windows → throws ENOENT → the catch returns { installed: false } → the hook emits the false "not installed" message.

Minimal reproduction

const { execFileSync } = require("node:child_process");
const bin = process.env.APPDATA + "\\npm\\vercel"; // the extensionless launcher resolveBinaryFromPath returns
execFileSync(bin, ["--version"]);                  // THROWS ENOENT
execFileSync(bin, ["--version"], { shell: true }); // OK -> 52.0.0

Proposed fix

Run the version check (and ideally the npm view check) through a shell on Windows:

const raw = execFileSync(vercelBinary, VERCEL_VERSION_ARGS, {
  timeout: EXEC_SYNC_TIMEOUT_MS,
  encoding: "utf-8",
  stdio: SPAWN_STDIO,
  shell: process.platform === "win32",
}).trim();

(Heads-up: shell: true + an args array triggers Node's DEP0190. It's harmless here since the args are a fixed --version, but if you'd rather avoid the warning you can build a single command string, or alternatively prefer the PATHEXT-extension candidates over the bare name on Windows and shell-out for .cmd.)

Happy to open a PR if useful.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in hooks/session-start-profiler.mjs at checkVercelCli(), then trace resolveBinaryFromPath("vercel") and the execFileSync version check. Reproduce on Windows with the extensionless launcher and compare it with vercel --version; done means an installed Vercel CLI is detected without the false "not installed" message.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.