Skip to content

Error in version 6.3.10: ReferenceError: React is not defined #5667

Closed

Description

@dreaganluna

Using redocly-cli to create documentation based on OpenAPI, the latest version started failing about 20 minutes ago (for us) with the following error, pointing to this dependency.

ReferenceError: React is not defined
    at Object.<anonymous> (/root/.npm/_npx/1738445911c9ab26/node_modules/styled-components/dist/styled-components.cjs.js:1:860)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)
    at require (node:internal/modules/helpers:182:18)
    at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:2:109941
    at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:1831:3804
    at /root/.npm/_npx/1738445911c9ab26/node_modules/redoc/bundles/redoc.lib.js:1831:3809

Activity

  1. tot-intini commented on Feb 18, 2026

    @tot-intini

    Seems like the version 6.3.10 has a bug, looking into the CJS bundle it uses React as a global variable (void 0 === React.createContext) instead of require('react'). This crashes in Node.js where React is not global.

  2. Yagasaki7K commented on Feb 18, 2026

    @Yagasaki7K

    Seems like the version 6.3.10 has a bug, looking into the CJS bundle it uses React as a global variable (void 0 === React.createContext) instead of require('react'). This crashes in Node.js where React is not global.

    So what's the solution? Hold off on updating until they fix this problem?

    The problem happens too in Next.js (v16.1.6)

  3. peterson-tubini commented on Feb 18, 2026

    @peterson-tubini

    Same issue happening with me too

  4. Arghadeep09 commented on Feb 19, 2026

    @Arghadeep09

    Same issue is generated

  5. klasnasman commented on Feb 19, 2026

    @klasnasman

    Same here on a new Astro / Sanity project.

    npm run sanity:generate gives me "ReferenceError: React is not defined"

    Pinning styled-components to 6.3.9 fixes it

  6. self-assigned this
    on Feb 19, 2026
  7. quantizor commented on Feb 19, 2026

    @quantizor
    Contributor

    On it!

  8. added 3 commits that reference this issue on Feb 19, 2026
    a52e5e4
    c0d2c59
    752f5ec
  9. quantizor commented on Feb 19, 2026

    @quantizor
    Contributor

    Sorry about that, please try 6.3.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions