{"record":{"id":"17af201006d2aba9","repo":"facebook/react","slug":"the-react-server-cannot-be-used-outside-a-react-se-17af20","errorCode":null,"errorMessage":"The React Server cannot be used outside a react-server environment. You must configure Node.js using the `--conditions react-server` flag.","messagePattern":"The React Server cannot be used outside a react-server environment\\. You must configure Node\\.js using the `--conditions react-server` flag\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-webpack/static.js","lineNumber":10,"sourceCode":"/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow\n */\n\nthrow new Error(\n  'The React Server cannot be used outside a react-server environment. ' +\n    'You must configure Node.js using the `--conditions react-server` flag.',\n);\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-webpack/static.js#L1-L14","documentation":"react-server-dom-webpack/static.js is the fallback './static' entry that throws unless the 'react-server' export condition is active. It guards the static Flight writer so that a mis-configured environment (plain Node, browser, or a bundler without the condition) fails at import time with the exact flag needed, rather than loading server-only code into the wrong runtime.","triggerScenarios":"Importing react-server-dom-webpack/static in any context where the resolver did not apply the 'react-server' condition (plain node, browser bundle, tests).","commonSituations":"Following RSC demos that use /static without copying the start script's --conditions react-server flag | Tooling (ts-node,tsx, vitest) that resolves exports with default conditions only | Monorepo task runners dropping NODE_OPTIONS","solutions":["Start the process with node --conditions react-server","Add 'react-server' to resolve.conditionNames (webpack), conditions (esbuild/vite ssr), or test runner export conditions","Double-check NODE_OPTIONS is present where the import actually executes (containers, cron, process managers)"],"exampleFix":"// before\n\"scripts\": {\"start\": \"node server.js\"}\n\n// after\n\"scripts\": {\"start\": \"node --conditions react-server server.js\"}","handlingStrategy":"validation","validationCode":"if (!(process.execArgv.join(' ') + ' ' + (process.env.NODE_OPTIONS || '')).includes('react-server')) {\n  console.error('fix: node --conditions react-server');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize the node start command; do not hand-type it per environment","Include the condition in test, dev, and prod commands identically","CI should run the server entry once as a smoke test"],"tags":["react-server-components","node","package-exports","conditions"],"backgroundTag":"missing-react-server-condition","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}