Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link

Description

@seanl-dev1
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.