#7779·recharts

Support Node.js 26 in development and CI

Author: PavelVanecekCreated Sep 9, 2026Updated Sep 9, 2026
Labelsenhancement

What is the current behavior?

The repository currently targets Node.js 24 (.nvmrc and NODE_VERSION: 24.x in CI). Running the website unit tests on Node.js 26.8.1 fails even after npm run build:

bash
npx vitest --project unit:website --config vitest.config.mts --run --reporter minimal

The failures occur in the color-mode-related website tests with errors such as:

TypeError: Cannot read properties of undefined (reading 'getItem')

Node.js 26 provides an experimental global localStorage accessor. Without --localstorage-file, it returns undefined. Vitest's jsdom environment sees the existing Node global and does not replace it with jsdom's window.localStorage, leaving tests that use the unqualified localStorage global broken.

npm run build succeeds and generates the website API sources; this is a separate runtime compatibility issue.

What is the expected behavior?

Node.js 26 should be an explicitly supported development and CI runtime, and the full build plus website test suite should pass without requiring developers to provide a Node-specific --localstorage-file.

Please provide a demo of the problem in a sandbox

N/A — this is a Node.js/Vitest/jsdom test-environment compatibility issue. It can be reproduced in the repository with the command above on Node.js 26.8.1.

Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?

  • Recharts: 3.11.0-canary.2 at main
  • Node.js: 26.8.1 on macOS arm64
  • Vitest: 4.1.11
  • jsdom: 29.1.1
  • Node.js 24.20.0: the same build and website test command passes

Required work

  • Decide and document the supported Node.js 26 baseline and whether Node 24 remains supported.
  • Update .nvmrc, CI workflows, setup/development documentation, and package metadata as appropriate.
  • Make the Vitest/jsdom test environment compatible with Node.js 26, preferably without relying on Node's --localstorage-file flag; likely options include using window.localStorage explicitly in website tests or ensuring Vitest can install jsdom's storage global.
  • Run the build, website tests, library tests, type checks, lint, and relevant CI jobs under Node.js 26.
  • Investigate and address any additional Node.js 26 incompatibilities exposed by the full suite.