Skip to content

bug: doctor flags standard npm shims as Multiple FixMap binaries and exits 1 on every Windows global install #642

Description

@aryamthecodebreaker

Summary

On a stock Windows machine, fixmap doctor always reports a PROBLEM and exits 1 immediately after a normal npm install --global @aryam/fixmap. The two "multiple binaries" it finds are the standard npm shims (fixmap and fixmap.cmd) generated in the same directory by that single global install — there is nothing stale or competing.

Environment

  • fixmap 0.9.0 (installed via npm install -g @aryam/fixmap)
  • Windows (win32), PowerShell 5.1
  • Node v24.13.0

Repro

npm install -g @aryam/fixmap
fixmap doctor
echo $LASTEXITCODE   # 1

Actual

# FixMap Doctor

- ok  Running version: 0.9.0
- ok  Resolved from: C:\Users\aryam\AppData\Roaming\npm\node_modules\@aryam\fixmap\dist\doctor.js
- PROBLEM  fixmap on PATH: C:\Users\aryam\AppData\Roaming\npm\fixmap; C:\Users\aryam\AppData\Roaming\npm\fixmap.cmd
    Multiple FixMap binaries are on PATH. Remove or reorder stale entries so one installation wins consistently.
- ok  Project install: none
- ok  Global install: 0.9.0 (matches)
- ok  Node version: 24.13.0

Fix the problems above; FixMap may otherwise run a different version than you asked for.

Exit code is 1.

The same PROBLEM finding is surfaced through the MCP server's fixmap_doctor tool, so agents see a failing self-diagnostic on every healthy Windows setup.

Expected

One global npm installation should produce an all-ok doctor result (exit 0) on Windows.

Root cause

resolveBinaries() runs where fixmap on win32 (dist/doctor.js, ~line 124):

  • A global npm install drops three launchers into one directory: %APPDATA%\npm\fixmap (sh), fixmap.cmd, and fixmap.ps1.
  • where fixmap returns both ...\npm\fixmap and ...\npm\fixmap.cmd as separate lines.
  • The new Set(...) de-dup only removes identical strings, so two different filenames from one install survive, binaries.length === 2, and the ok: false branch fires.

So the check counts files instead of installations, and every default npm-on-Windows layout trips it. Following the advice ("Remove or reorder stale entries") would break fixmap invocation from cmd.exe, since removing fixmap.cmd removes the only launcher cmd.exe can execute.

It also means doctor exits nonzero out of the box, so any CI or script that gates on fixmap doctor fails on healthy Windows machines.

Suggested fix

Any of these would work:

  1. Group where results by parent directory and treat same-directory .cmd/.ps1/extensionless siblings as one installation.
  2. Filter out shim extensions that sit next to an extensionless twin before counting.
  3. Resolve each PATH hit to the underlying node_modules/@aryam/fixmap package it launches and compare versions instead of counting files — that also catches the real shadowing case doctor cares about, without penalizing the standard Windows layout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions