facebook/flow · error · Error
Pkg flow-bin not found in ${dirsToCheck.join(', ')}
Error message
Pkg flow-bin not found in ${dirsToCheck.join(', ')} What it means
With the useNPMPackagedFlow strategy, the extension searches for the flow-bin npm package in the .flowconfig directory and then the workspace root. If neither directory yields a usable flow binary, it throws listing the directories searched.
Source
Thrown at packages/flow-for-vscode/src/utils/getFlowPath.ts:97
workspaceRoot: string,
logger: Logger,
): Promise<string> {
const dirsToCheck = [
// a) check in flowconfig dir
flowconfigDir,
// b) check in workspaceRoot (ignore if flowconfigDir and workspaceRoot same)
flowconfigDir !== workspaceRoot ? workspaceRoot : null,
].filter((v) => v != null);
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)View on GitHub (pinned to d1341dac89)
Solutions
- Run `npm install --save-dev flow-bin` in one of the directories named in the error message
- In workspaces, install flow-bin in the package that owns the .flowconfig, or at the root the extension checks
- Alternatively set `flow.pathToFlow` to the absolute binary path
Example fix
# before: error "Pkg flow-bin not found in /repo/packages/app, /repo" # flow-bin is not installed anywhere # after (run in a listed dir, e.g. /repo) npm install --save-dev flow-bin # /repo/node_modules/flow-bin now exists and the extension resolves it
Defensive patterns
Strategy: validation
Validate before calling
function flowBinInstalled(dirs: string[]): boolean {
return dirs.some((d) => {
try {
require.resolve('flow-bin', {paths: [d]});
return true;
} catch {
return false;
}
});
}
// call with [flowconfigDir, workspaceRoot] before enabling useNPMPackagedFlow Try / catch
try {
const p = await getNpmPackagedFlow(flowconfigDir, workspaceRoot, logger);
} catch (err) {
if (/Pkg flow-bin not found/.test(err.message)) {
// fall through to the pathToFlow strategy instead of failing hard
} else throw err;
} Prevention
- Install flow-bin in the same package that owns the .flowconfig
- Verify node_modules layout after workspace conversions (pnpm/yarn PnP)
- Run npm install after clone before opening VS Code
When it happens
Trigger: `flow.useNPMPackagedFlow` is enabled and neither <flowconfigDir> nor <workspaceRoot> contains node_modules/flow-bin with a resolvable binary.
Common situations: flow-bin hoisted to a directory outside the workspace root; pnpm/yarn PnP layouts the resolver cannot traverse; flowconfig in a nested package while flow-bin is installed only at the repo root (or vice versa); fresh clone before npm install.
Related errors
- Failed to find anything starting with ${dirPrefix} in ${flow
- Flow version ${version} doesn't support 'flow lsp'. Please u
- Unsupported .flowconfig option `log.file`. The VS Code exten
- Failed to find extensionPath
- Flow not found
AI-assisted analysis of facebook/flow@d1341dac89 (2026-08-17).
Data as JSON: /api/errors/fe3331a21856f20d.
Report an issue: GitHub.