FlowiseAI/Flowise · error · Error
Failed to load fs/promises. Make sure you are running in Nod
Error message
Failed to load fs/promises. Make sure you are running in Node.js environment.
What it means
Thrown by TextLoader.imports() in Jsonlines.ts when import('node:fs/promises') rejects. Identical cause to Json.ts: the Node fs built-in is unavailable in the current runtime or stripped by a bundler.
Source
Thrown at packages/components/nodes/documentloaders/Jsonlines/Jsonlines.ts:290
? { ...metadata, ...additionalMetadata }
: {
...metadata,
line: i + 1,
...additionalMetadata
}
})
})
}
static async imports(): Promise<{
readFile: typeof ReadFileT
}> {
try {
const { readFile } = await import('node:fs/promises')
return { readFile }
} catch (e) {
console.error(e)
throw new Error(`Failed to load fs/promises. Make sure you are running in Node.js environment.`)
}
}
}
class JSONLinesLoader extends TextLoader {
metadata?: ICommonObject
additionalMetadata: ICommonObject[] = []
constructor(filePathOrBlob: string | Blob, public pointer: string, metadata?: any) {
super(filePathOrBlob)
if (metadata) {
this.metadata = typeof metadata === 'object' ? metadata : JSON.parse(metadata)
}
}
async getAdditionalMetadata(): Promise<ICommonObject[]> {
return this.additionalMetadata
}View on GitHub (pinned to abe4a8601a)
Solutions
- Run on Node >= 16, or pass a Blob instead of a file path to skip the fs branch.
- Mark node:fs/promises as external in the bundler.
- Upgrade Node.js.
- Use the Blob input path for non-Node runtimes.
Example fix
// before
new JSONLinesLoader('/data/log.jsonl', '/msg')
// after
const blob = new Blob([text], { type: 'application/x-ndjson' })
new JSONLinesLoader(blob, '/msg') Defensive patterns
Strategy: validation
Validate before calling
function isNodeFsAvailable() {
try { require.resolve('node:fs/promises'); return true } catch { return false }
} Type guard
function isBlob(v) { return typeof Blob !== 'undefined' && v instanceof Blob } Try / catch
try {
return await jsonLinesLoader.imports()
} catch (e) {
if (/Failed to load fs\/promises/.test(e.message)) {
throw new Error('Use Node.js or pass a Blob', { cause: e })
}
throw e
} Prevention
- Pass a Blob for non-Node runtimes.
- Mark node:fs/promises external in bundler config.
- Run on Node >= 16.
- Confirm runtime before file-path input.
When it happens
Trigger: Browser/edge runtime without node:fs/promises; bundler not marking the module external; Node < 16; ESM/CJS interop dropping the node: scheme.
Common situations: Serverless browser runtime; misconfigured webpack/rollup/esbuild; corrupted Node install; old Node version.
Related errors
- Failed to load fs/promises. Make sure you are running in Nod
- Please set an API key for HuggingFace Hub. Either configure
- Please install huggingface as a dependency with, e.g. `pnpm
- Please install replicate as a dependency with, e.g. `yarn ad
- Mem0: "Use Flowise Chat ID" is ON, but no runtime chat ID (o
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/e0d0d278ca8194e1.
Report an issue: GitHub.