{"record":{"id":"c7ab40d5ef98f26d","repo":"facebook/react","slug":"the-react-server-writer-cannot-be-used-outside-a-r-c7ab40","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/server.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/server.js#L1-L7","documentation":"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).","triggerScenarios":"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.","commonSituations":"Running the server entry with plain `node`; jest/vitest without condition propagation; isomorphic code that imports both client and server entries unconditionally.","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"],"exampleFix":"# before\n$ node server.js   # import of react-server-dom-turbopack/server 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('Server writer requires --conditions react-server');\n}\nconst {renderToPipeableStream} = require('react-server-dom-turbopack/server.node');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["react-server-components","turbopack","node-conditions","environment","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"}