facebook/react · critical · Error
The React Server Writer cannot be used outside a react-serve
Error message
The React Server Writer cannot be used outside a react-server environment. You must configure Node.js using the `--conditions react-server` flag.
What it means
react-server-dom-turbopack/server resolves to the Flight writer only under the react-server Node export condition; this npm fallback stub throws at import time to keep the server-only writer out of non-react-server processes (client bundles, plain Node).
Source
Thrown at packages/react-server-dom-turbopack/npm/server.js:3
'use strict';
throw new Error(
'The React Server Writer cannot be used outside a react-server environment. ' +
'You must configure Node.js using the `--conditions react-server` flag.'
);
View on GitHub (pinned to eafeac097b)
Solutions
- Run Node with --conditions react-server when the process imports the writer
- Keep writer imports inside modules only ever loaded in the react-server condition branch
- Teach bundlers/test runners the react-server condition so the real entry resolves
Example fix
# before $ node server.js # import of react-server-dom-turbopack/server throws # after $ node --conditions react-server server.js
Defensive patterns
Strategy: validation
Validate before calling
const args = process.execArgv.join(' ');
if (!args.includes('react-server')) {
throw new Error('Server writer requires --conditions react-server');
}
const {renderToPipeableStream} = require('react-server-dom-turbopack/server.node'); Prevention
- Run writer-importing processes with --conditions react-server
- Keep server imports in modules only loaded from the react-server branch
- Propagate the condition through bundlers and test runners
When it happens
Trigger: Importing react-server-dom-turbopack/server in a Node process launched without --conditions react-server, or a bundler resolving the conditionless fallback export into a client/server-hybrid graph.
Common situations: Running the server entry with plain `node`; jest/vitest without condition propagation; isomorphic code that imports both client and server entries unconditionally.
Related errors
- The React Server cannot be used outside a react-server envir
- The React Server cannot be used outside a react-server envir
- The React Server Writer cannot be used outside a react-serve
- Use react-server-dom-turbopack/client instead.
- Use react-server-dom-turbopack/client instead.
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/c7ab40d5ef98f26d.
Report an issue: GitHub.