facebook/flow · error · Error

'${command}' not found

Error message

'${command}' not found

What it means

Strategy 2 of flow resolution: the `pathToFlow` setting (normalized against flowconfigDir/workspaceRoot) is resolved with a which-style PATH lookup. If the command is not an existing file and not on PATH, it throws "'<command>' not found".

Source

Thrown at packages/flow-for-vscode/src/utils/getFlowPath.ts:107

  for (let i = 0; i < dirsToCheck.length; i += 1) {
    // eslint-disable-next-line no-await-in-loop
    const flowPath = await getFlowBinPath(dirsToCheck[i], logger);
    if (flowPath) {
      return flowPath;
    }
  }

  throw new Error(`Pkg flow-bin not found in ${dirsToCheck.join(', ')}`);
}

async function getCommandFlowPath(
  command: string,
  logger: Logger,
): Promise<string> {
  logger.trace(`Checking '${command}'`);
  const flowPath = await which(command);
  if (!flowPath) {
    throw new Error(`'${command}' not found`);
  }
  return flowPath;
}

function getBundledFlowPath(): string {
  const extensionPath = getExtensionPath();
  // NOTE: 'vsce package' never bundles node_modules/.bin folder
  // (see: https://github.com/Microsoft/vscode/issues/53916)
  // so require module instead of using node_moudles/.bin
  const bundledFlowModulePath = path.join(
    extensionPath,
    'node_modules',
    'flow-bin',
  );
  return importFresh(bundledFlowModulePath);
}

async function getFlowBinPath(

View on GitHub (pinned to d1341dac89)

Solutions

  1. Set `flow.pathToFlow` to the absolute path of the binary (run `which flow` in your shell to get it)
  2. For PATH lookup, launch VS Code from a shell where `flow` resolves, or symlink flow into a standard dir like /usr/local/bin
  3. Fix typos and expansion issues in the setting

Example fix

// before (settings.json) — 'flow' is not on VS Code's PATH
{ "flow.pathToFlow": "flow" }

// after — absolute path from your shell's `which flow`
{ "flow.pathToFlow": "/Users/me/.nvm/versions/node/v20/bin/flow" }
Defensive patterns

Strategy: validation

Validate before calling

import which from 'which';

async function commandResolvable(cmd: string): Promise<boolean> {
  try {
    await which(cmd);
    return true;
  } catch {
    return false;
  }
}
// validate the normalized pathToFlow value before resolution

Try / catch

try {
  const flowPath = await getCommandFlowPath(command, logger);
} catch (err) {
  if (/not found$/.test(err.message)) {
    // tell the user exactly which command failed and suggest an absolute path
  } else throw err;
}

Prevention

When it happens

Trigger: `flow.pathToFlow` set to a bare command name (e.g. 'flow') that is not on the extension host's PATH, or a path that does not exist after normalization (typos, unexpanded ~).

Common situations: flow installed via a version manager (nvm/asdf) whose bin dir is not in GUI-launched VS Code's environment; typos in pathToFlow; a differently-named binary (e.g. flow-linux64-...); relative paths resolving from the wrong dir.

Related errors


AI-assisted analysis of facebook/flow@d1341dac89 (2026-08-17). Data as JSON: /api/errors/4a08c94c97077bab. Report an issue: GitHub.