A code-viewing web app started returning 500 on its home page under the dev server. The error was TypeError: localStorage.getItem is not a function. A search of the project's own source for localStorage found zero occurrences.
A global that was only half there
The machine had recently moved to Node 25. That release exposes web storage globals in the server runtime, and on that version localStorage existed as an object while getItem on it was undefined. The framework's server-side rendering path checks for the global, found it, called the method, and crashed. The framework declared support for Node 20 and above, which is not the same as being tested on 25.
The fix was to install Node 22 LTS, link it as the default, and pin the project to it: an engines field of >=20 <23 and a .nvmrc naming 22.22.3. The home page rendered its eight sections and both API routes returned 200. A separate Vite project on the same machine was checked afterwards and still ran on 22.
The fix broke the thing it replaced
Installing node@22 through the package manager upgraded a shared dependency, and the existing Node 25 install stopped loading because it wanted an older libsimdjson build. Node 25 was the cause of the original problem and was now broken anyway, so it was uninstalled along with its orphaned dependencies. That was recorded as a side effect, not as a plan.
One line in the record is weaker than the rest. It says the home page returned 200 once a valid database backing file was attached, and treats that as confirming the diagnosis. That step mixes a data fix into a runtime fix, and the Node 25 behaviour was never reproduced in isolation. The version pin held, and the page stayed up, which is what the day needed. The causal chain is more plausible than proven.