Skip to content

[skipped] on Windows due to which command not found #17

Description

@273c

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.

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