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
react-server-dom-parcel/static is the Edge/static build of the Flight server. The package's export map resolves the real implementation only under the react-server Node condition; everything else resolves to this stub, which throws at import time so the server serialization runtime never loads inside a non-react-server process.
Source
Thrown at packages/react-server-dom-parcel/static.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
- Start Node with the condition flag: node --conditions react-server server.js
- Load the server entry only inside code paths that run under the react-server condition (guarded dynamic require)
- Configure bundlers and test runners to honor the react-server export condition
Example fix
# before $ node server.js # importing react-server-dom-parcel/static 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('Start this process with --conditions react-server');
}
const RSCServer = require('react-server-dom-parcel/static'); Prevention
- Bake --conditions react-server into npm scripts that run server entrypoints
- Mirror the react-server condition in jest/vitest and bundler configs
- Never import server/static entries from shared isomorphic modules
When it happens
Trigger: Importing 'react-server-dom-parcel/static' (directly or transitively) in a Node process started without --conditions react-server, or when a bundler/test runner resolves the conditionless fallback export.
Common situations: Running server code with plain `node server.js`; jest/vitest runners that do not propagate Node execution conditions; deploy scripts or framework configs missing the react-server flag.
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
- react-dom/profiling is not supported in React Server Compone
- react-dom/server is not supported in React Server Components
AI-assisted analysis of facebook/react@eafeac097b (2026-08-21).
Data as JSON: /api/errors/aa063fa59a365f4a.
Report an issue: GitHub.