microlinkhq / microlinkhq/optimo

[skipped] on Windows due to `which` command not found

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

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
185
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Environment
  • OS: Windows 11
  • Shell: PowerShell / cmd.exe
  • Node.js: v24.14.1
  • optimo: 0.0.27
  • ffmpeg: 8.1 (installed via Scoop)
Description

optimo always reports [skipped] with the message ffmpeg: Run brew install ffmpeg to fix it on Windows, even when ffmpeg is correctly installed and available in PATH.

Root cause

src/util/resolve-binary.js uses which to detect binaries:

execSync(`which ${binary}`, { stdio: ['pipe', 'pipe', 'ignore'] })

which is a Unix command and does not exist on Windows natively. This causes execSync to throw, resolve-binary returns false, and the file is silently skipped.

Note: running optimo from Git Bash returns [unsupported] instead of [skipped], because Git Bash ships its own which. This difference in behavior is what helped narrow down the root cause.

Workaround

Installing which via Scoop (scoop install which) fixes the issue immediately.

Suggested fix

Fall back to where.exe on Windows:

const { execSync } = require('node:child_process')
const isWindows = process.platform === 'win32'

module.exports = binary => {
  try {
    const cmd = isWindows ? `where.exe ${binary}` : `which ${binary}`
    return execSync(cmd, { stdio: ['pipe', 'pipe', 'ignore'] })
      .toString()
      .trim()
      .split('\n')[0] // where.exe may return multiple lines
  } catch {
    return false
  }
}

Alternatively, packages like which (npm) handle cross-platform binary resolution out of the box.

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 src/util/resolve-binary.js and inspect how binary lookup behaves on Windows versus Unix. Reproduce the issue with optimo in PowerShell or cmd.exe while ffmpeg is on PATH, then verify that lookup succeeds on Windows and the file is no longer reported as skipped; also check that the existing Unix behavior remains unchanged.

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
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.