Skip to content

corebrain setup fails on Windows: "docker not found on PATH" when Docker is installed #904

Description

@delight-f

corebrain setup fails on Windows: "docker not found on PATH" when Docker is installed

Description

Running corebrain setup on Windows immediately fails with:

■  `docker` not found on PATH. Install Docker Desktop (or the docker engine) and retry.

This occurs even when Docker Desktop is installed and docker is accessible from the terminal (e.g., Git Bash, PowerShell, CMD).

Root Cause

The commandExists helper in the setup utilities uses command -v to check whether a binary is on PATH:

async function commandExists(cmd: string): Promise<boolean> {
    try {
        await exec(`command -v ${cmd}`);
        return true;
    } catch {
        return false;
    }
}

command -v is a POSIX shell builtin. On Windows, Node.js's child_process.exec() uses cmd.exe (via the ComSpec environment variable), which does not recognize command. The call silently fails, commandExists returns false, and the setup aborts.

The same function exists in at least three files:

  • apps/cli/src/utils/setup/local.ts
  • apps/cli/src/utils/setup/docker.ts
  • apps/cli/src/utils/setup/railway.ts

Environment

  • OS: Windows (11, Git Bash / MSYS2 shell)
  • Node.js: v25.9.0
  • @redplanethq/corebrain: 2.8.30
  • Docker Desktop: 29.5.3 (installed at C:\Program Files\Docker\Docker\resources\bin\)

Steps to Reproduce

  1. Install Docker Desktop on Windows.
  2. npm install -g @redplanethq/corebrain
  3. corebrain setup
  4. Observe the error.

Suggested Fix

Use where on Windows and command -v on POSIX:

async function commandExists(cmd: string): Promise<boolean> {
    try {
        await exec(`${process.platform === 'win32' ? 'where' : 'command -v'} ${cmd}`);
        return true;
    } catch {
        return false;
    }
}

Workaround

  1. Patch the installed files manually (re-applied after each npm install -g):
# In each of:
#   %APPDATA%\npm\node_modules\@redplanethq\corebrain\dist\utils\setup\local.js
#   %APPDATA%\npm\node_modules\@redplanethq\corebrain\dist\utils\setup\docker.js
#   %APPDATA%\npm\node_modules\@redplanethq\corebrain\dist\utils\setup\railway.js

# Replace:
#   await exec(`command -v ${cmd}`)
# With:
#   await exec(`${process.platform === "win32" ? "where" : "command -v"} ${cmd}`)
  1. Alternatively, ensure SHELL env var points to a POSIX shell (e.g., Git Bash's /usr/bin/sh) — though this is fragile.

Affected Files (source)

  • apps/cli/src/utils/setup/local.ts
  • apps/cli/src/utils/setup/docker.ts
  • apps/cli/src/utils/setup/railway.ts

The same commandExists function pattern is used in all three files, so a single fix applied to a shared utility would prevent the duplication.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions