facebook/react · critical · Error
The React Server cannot be used outside a react-server envir
Error message
The React Server cannot be used outside a react-server environment. You must configure Node.js using the `--conditions react-server` flag.
What it means
The turbopack Flight server entry throws at import time unless the react-server Node condition is active. The export map swaps this stub for the real server runtime only when Node resolves conditions include react-server, preventing the serialization runtime from loading in client contexts.
Source
Thrown at packages/react-server-dom-turbopack/server.js:10
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
throw new Error(
'The React Server 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
- Launch with node --conditions react-server wherever the server entry loads
- Scope server-entry imports to react-server conditional branches only
- Verify test/bundler config propagates react-server 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('Flight server entry requires --conditions react-server');
}
const {renderToPipeableStream} = require('react-server-dom-turbopack/server'); Prevention
- Include --conditions react-server in all server-launch scripts
- Scope server-entry imports to react-server conditional branches
- Verify CI and test configs forward the condition
When it happens
Trigger: import/require of react-server-dom-turbopack/server in a Node process started without --conditions react-server, or via a bundler that resolved the fallback export.
Common situations: Plain `node` invocations of server entrypoints; CI scripts and test runners that do not forward Node conditions; framework configs that dropped the flag after an upgrade.
Related errors
- The React Server Writer cannot be used outside a react-serve
- 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/f00592ddc68eb65d.
Report an issue: GitHub.