{"record":{"id":"a7e7881e5bb03f93","repo":"facebook/react","slug":"the-react-server-writer-cannot-be-used-outside-a-r-a7e788","errorCode":null,"errorMessage":"The React Server Writer cannot be used outside a react-server environment. You must configure Node.js using the `--conditions react-server` flag.","messagePattern":"The React Server Writer 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":"critical","filePath":"packages/react-server-dom-turbopack/npm/static.js","lineNumber":3,"sourceCode":"'use strict';\n\nthrow new Error(\n  'The React Server Writer 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":7,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-turbopack/npm/static.js#L1-L7","documentation":"react-server-dom-turbopack/static (the Edge/static writer build) only resolves to a real implementation under the react-server export condition. Without that condition, this npm stub throws on import so the server-only Flight writer never executes in an unintended environment.","triggerScenarios":"Importing react-server-dom-turbopack/static in a Node process without --conditions react-server, or resolving the conditionless fallback export from a client/bundler graph.","commonSituations":"Edge-runtime code executed under plain Node in tests; deploy scripts missing the condition flag; monorepos where the condition is set for the app but not for tooling.","solutions":["Start the process with node --conditions react-server","Import the static writer only from modules conditionally loaded in the react-server branch","Mirror the react-server condition in bundler/test configuration"],"exampleFix":"# before\n$ node server.js   # import of react-server-dom-turbopack/static throws\n\n# after\n$ node --conditions react-server server.js","handlingStrategy":"validation","validationCode":"const args = process.execArgv.join(' ');\nif (!args.includes('react-server')) {\n  throw new Error('Static writer requires --conditions react-server');\n}\nconst RSCStatic = require('react-server-dom-turbopack/static');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start Edge-runtime processes in tests with the react-server condition too","Load static writer entries only inside condition-gated branches","Keep the flag in every script that can import server code"],"tags":["react-server-components","turbopack","node-conditions","edge-runtime","import-time-error"],"backgroundTag":"react-server-condition-missing","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}