Registry / http-networking / flow-bin

flow-bin

JSON →
library0.310.0jsnpmunverified

Flow-bin is a wrapper package that provides the Flow static type checker binary for JavaScript projects. Developed primarily by Facebook/Meta, Flow offers static analysis capabilities similar to TypeScript, inferring types and catching errors before runtime. The package, currently at version `0.310.0`, bundles the corresponding Flow `0.310.0` binary, making it accessible via `npm` or `yarn` scripts and programmatically through Node.js's `child_process` module. While Flow itself is still actively developed and utilized internally at Meta, its public GitHub repository has been archived, meaning external contributions are no longer accepted, and community support is more limited. This positions `flow-bin` primarily as a maintenance package for delivering Meta's internal Flow updates to the public, rather than an actively evolving open-source project. Its release cadence is tied directly to Flow's internal release schedule. It serves as an alternative to TypeScript for adding static typing to JavaScript projects.

npm install flow-bin
INSTALL
IMPORT
SIG · FLOW-BIN
F
flow-bin
http-networkingjavascriptv0.310.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

flowBinaryPath
const flowBinaryPath = require('flow-bin');
import { flowBinaryPath } from 'flow-bin'; // Not a named export. import flowBinaryPath from 'flow-bin'; // May fail in CJS projects without configuration.
The package exports a string representing the absolute path to the Flow binary. CommonJS `require()` is the most common and reliable method. While modern Node.js environments or bundlers might allow `import flowBinaryPath from 'flow-bin'` for ESM contexts, `flow-bin` is primarily a CJS package.

This quickstart demonstrates how to programmatically invoke the Flow binary using Node.js's `child_process.execFile` and parse its JSON output for type checking results.

const execFile = require('child_process').execFile; const flow = require('flow-bin'); console.log(`Running Flow from: ${flow}`); execFile(flow, ['check', '--json'], (err, stdout, stderr) => { if (err) { console.error('Flow check failed:', err.message); if (stderr) console.error('Stderr:', stderr); try { const errorOutput = JSON.parse(stdout); console.error('Flow errors:', JSON.stringify(errorOutput, null, 2)); } catch (parseErr) { console.error('Stdout (non-JSON on error):', stdout); } process.exit(1); } else { console.log('Flow check successful.'); try { const result = JSON.parse(stdout); if (result.errors && result.errors.length > 0) { console.warn('Flow reported warnings/errors:', JSON.stringify(result.errors, null, 2)); } else { console.log('No Flow issues found.'); } } catch (parseErr) { console.warn('Could not parse Flow output as JSON:', stdout); } } });
flow --version
Debug
Known issues
breakingThe Flow type checker project, which `flow-bin` wraps, has archived its public GitHub repository and no longer accepts external contributions. While still developed internally by Meta, this significantly limits community-driven feature development and direct public bug reporting for the upstream tool.
fix
Be aware that community support and external development for Flow are limited. For open-source projects, consider alternatives like TypeScript for more active community engagement and ecosystem tools.
affects: >=0.105.0
gotchaThe `flow-bin` package version is directly coupled to the Flow type checker version it bundles. Breaking changes or new features in Flow itself will directly impact users of `flow-bin`, even if `flow-bin`'s wrapper logic hasn't changed.
fix
Always review Flow's official release notes when upgrading `flow-bin` to understand potential breaking changes or new configuration requirements for the type checker itself.
affects: >=0.1.0
gotchaThe `flow-bin@v0.105.0` npm release was published without the actual Flow binaries, leading to 'command not found' errors. This required a patch release `v0.105.1`.
fix
Ensure you are using `flow-bin@v0.105.1` or newer if targeting Flow `v0.105.0` to guarantee the binaries are included.
affects: 0.105.0
Errors
Common errors & fixes
Error: Command failed: /path/to/node_modules/flow-bin/flow check /bin/sh: /path/to/node_modules/flow-bin/flow: No such file or directory
The Flow binary was not found at the expected path, often due to an incomplete `flow-bin` installation or a corrupted package.
fix
Try running `npm rebuild flow-bin` or `npm install --force` to ensure the package and its binaries are correctly installed. Verify the version you are using is not `0.105.0`.
Error: Linter: Failed to load Flow config at path. Please make sure that a .flowconfig file is present in your project root or specified using --flowconfig.
Flow requires a `.flowconfig` file in the project root to operate. This error indicates it's missing or inaccessible.
fix
Create a `.flowconfig` file in your project's root directory. A minimal `.flowconfig` can be empty or include `[options]` and `[ignore]` sections. Refer to Flow documentation for configuration details.
SyntaxError: Cannot use import statement outside a module
Attempting to use ESM `import flowPath from 'flow-bin'` in a Node.js environment configured for CommonJS, or without proper transpilation.
fix
For CommonJS environments, use `const flowPath = require('flow-bin');`. If you intend to use ESM, ensure your `package.json` contains `"type": "module"` and your Node.js version supports ESM, or use a bundler like Webpack or Rollup configured for ESM.
Upgrade
Version history
0.310.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
flow-bin — npm install flow-bin · libregistry