Repository navigation
Regression 25.2.0 - Cannot initialize local storage without a --localstorage-file path #60704
Description
Activity
Code to reproduce:
const myVars = Object.keys(globalThis); for (const item of myVars) { console.log(globalThis[item]); }
Very often you need to run through all global variables, especial in tools like testing frameworks/bundlers/etc, so it should not throw an error when you touch this
Reacted by Rob Hogan, Falderian, Sébastien Lorber and koroliovThis also broke Docusaurus production builds: facebook/docusaurus#11545
The production build issue is caused by this npm "eval" lib we use (1m download, but legacy/archived and won't be patched): https://github.com/pierrec/node-eval/blob/master/eval.js
This also broke our dev server through html-webpack-plugin: jantimon/html-webpack-plugin#1880
Reacted by Joel Marcey and koroliovVery often you need to run through all global variables, especial in tools like testing frameworks/bundlers/etc, so it should not throw an error when you touch this
The core assumption that enumerating the global object should never raise an exception, or that it should be side-effect-free at all, is not a valid one. This action would already throw in Node.js >=19 in builds without crypto support, and can definitely throw in browser environments. (Indeed, it also throws in Node.js <=24 if experimental local storage is enabled.)
I would have preferred this change to land in a major release for sure.
Ditto, although it was technically an "unchange" – the specification-compliant throw-on-access behaviour existed in v24, albeit behind a flag.
@Renegade334 I am not against such changes, but this is definitely a breaking change for this release, as you can see many well-known packages are broken...
Reacted by René, Sébastien Lorber, Steven Luscher, Jason Marshall, kestrelbright, Falderian, raytan-ncl, Arthur Woimbée, Jisagi, Artoooooor and 3 more- added a commit that references this issue
on Nov 13, 2025 Consider passing
--no-experimental-webstorageas a flag or in yourNODE_OPTIONSto unblock yourself if you're not usinglocalStorage.Reacted by koroliov and Jim VPThis bit us when building Docusaurus in Anubis
Reacted by Joel Marcey and ArthurMade my argument here to motivate a revert: #60351 (comment)
TLDR:
- the web spec behavior is questionable and probably historical
- server runtimes !== web
- Deno doesn't throw by default
- this should probably be discussed in TC55 (Winter TC) to align the behavior of server runtimes
Reacted by Alexander Akait and Joel Marcey@slorber Agreed, at least we need time to migrate, Node.js can output a warning and after resolving this problem in TC55 change this behavior in the next major release, so we will have time to refactor code and make releases
Rather than a pure reversion, the more useful approach for backing off this change (and one which would be consistent with the presence tests mentioned previously) would be to switch from option 2 to option 1 from #60303, ie. expose
undefinedrather than throwing. This should at least not re-introduce the previous break for actual storage consumers.Reacted by Alexander Akait, Matteo Collina and Sébastien Lorber- addedweb-standardsIssues and PRs related to web-platform APIs and standards compliance.Issues and PRs related to web-platform APIs and standards compliance.
on Nov 14, 2025 Do we know why CITGM didn't flag this?
Do we know why CITGM didn't flag this?
It did. #60677 (comment). The Release WG discussed, and based on the change being deliberate and in an experimental feature we decided not to block the release.
Reacted by Simen Bekkhus10 remaining items
Thanks for reverting the change!
As far as I understand, you may still keep this change as-is for v26, which means we are delaying the breakage. It gives us time to upgrade the existing problematic call sites.
Can you please help us migrate common patterns, such as cloning
{...global}?See also #60750 (comment)
Reacted by txtsd- added a commit that references this issue
on Nov 17, 2025 Just for reference - Jest's looping through all the globals would be replaced with #46558 if it's ever implemented
Reacted by Sébastien Lorber- added a commit that references this issue
on Nov 18, 2025 - added a commit that references this issue
on Nov 21, 2025 - added a commit that references this issue
on Nov 21, 2025 - added a commit that references this issue
on Nov 26, 2025 - added a commit that references this issue
on Feb 17, 2026 - added a commit that references this issue
on Feb 24, 2026 - added a commit that references this issue
on Apr 16, 2026 - added a commit that references this issue
on May 16, 2026
Version
25.2.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Touching localStorage global variable produce the problem
Ref: webpack/webpack#20119 (we fixed this, but jest is broken)
Ref: jestjs/jest#15888 (jest issue)
Another ref where logic is broken - jantimon/html-webpack-plugin#1880
And more
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
No warning
What do you see instead?
Any workarounds
Additional information
No response