{"record":{"id":"4a08c94c97077bab","repo":"facebook/flow","slug":"command-not-found","errorCode":null,"errorMessage":"'${command}' not found","messagePattern":"'(.+?)' not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/flow-for-vscode/src/utils/getFlowPath.ts","lineNumber":107,"sourceCode":"  for (let i = 0; i < dirsToCheck.length; i += 1) {\n    // eslint-disable-next-line no-await-in-loop\n    const flowPath = await getFlowBinPath(dirsToCheck[i], logger);\n    if (flowPath) {\n      return flowPath;\n    }\n  }\n\n  throw new Error(`Pkg flow-bin not found in ${dirsToCheck.join(', ')}`);\n}\n\nasync function getCommandFlowPath(\n  command: string,\n  logger: Logger,\n): Promise<string> {\n  logger.trace(`Checking '${command}'`);\n  const flowPath = await which(command);\n  if (!flowPath) {\n    throw new Error(`'${command}' not found`);\n  }\n  return flowPath;\n}\n\nfunction getBundledFlowPath(): string {\n  const extensionPath = getExtensionPath();\n  // NOTE: 'vsce package' never bundles node_modules/.bin folder\n  // (see: https://github.com/Microsoft/vscode/issues/53916)\n  // so require module instead of using node_moudles/.bin\n  const bundledFlowModulePath = path.join(\n    extensionPath,\n    'node_modules',\n    'flow-bin',\n  );\n  return importFresh(bundledFlowModulePath);\n}\n\nasync function getFlowBinPath(","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/facebook/flow/blob/d1341dac899a79c027762f6b423d896045287620/packages/flow-for-vscode/src/utils/getFlowPath.ts#L89-L125","documentation":"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\".","triggerScenarios":"`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 ~).","commonSituations":"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.","solutions":["Set `flow.pathToFlow` to the absolute path of the binary (run `which flow` in your shell to get it)","For PATH lookup, launch VS Code from a shell where `flow` resolves, or symlink flow into a standard dir like /usr/local/bin","Fix typos and expansion issues in the setting"],"exampleFix":"// before (settings.json) — 'flow' is not on VS Code's PATH\n{ \"flow.pathToFlow\": \"flow\" }\n\n// after — absolute path from your shell's `which flow`\n{ \"flow.pathToFlow\": \"/Users/me/.nvm/versions/node/v20/bin/flow\" }","handlingStrategy":"validation","validationCode":"import which from 'which';\n\nasync function commandResolvable(cmd: string): Promise<boolean> {\n  try {\n    await which(cmd);\n    return true;\n  } catch {\n    return false;\n  }\n}\n// validate the normalized pathToFlow value before resolution","typeGuard":null,"tryCatchPattern":"try {\n  const flowPath = await getCommandFlowPath(command, logger);\n} catch (err) {\n  if (/not found$/.test(err.message)) {\n    // tell the user exactly which command failed and suggest an absolute path\n  } else throw err;\n}","preventionTips":["Prefer absolute paths in flow.pathToFlow","Launch VS Code from a shell that has flow on PATH (or use code from terminal)","Re-check settings after switching node version managers"],"tags":["flow","vscode","path","which","command"],"backgroundTag":"command-not-on-path","analyzedSha":"d1341dac899a79c027762f6b423d896045287620","analyzedAt":"2026-08-17T00:07:02.212Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}