⨯ [TypeError: localStorage.getItem is not a function]

Hello - While dipping my toes in this tutorial, I’m being greeted by the following errors when starting the server. Does anyone else experience the same issue? If so, could you share what the solution is? Thanks.

‘which pnpm’ returns ~/.nvm/versions/node/v25.2.1/bin/pnpm

I’ve tried both VSCode and VSCodium. I’m simply following the instructions in the tutorial and haven’t changed anything either in the code or within the IDEs.

(node:9660) Warning: --localstorage-file was provided without a valid path
(Use node --trace-warnings ... to show where the warning was created)
⨯ [TypeError: localStorage.getItem is not a function] {
digest: ‘2944369831’
}
[TypeError: localStorage.getItem is not a function]
⨯ [TypeError: localStorage.getItem is not a function] { page: ‘/’ }
○ Compiling /_error …
✓ Compiled /_error in 2.2s
[TypeError: localStorage.getItem is not a function]
[TypeError: localStorage.getItem is not a function]
⨯ [TypeError: localStorage.getItem is not a function]
⨯ [TypeError: localStorage.getItem is not a function]

I’m trying

What Next.js version exactly? 15.3.2? IIRC this is a Node 25 bug, that surfaces on that specific Next.js minor version (15.3).

2 Likes

Just a follow up. You can safely install version 16 or if you wanna stay within 15 for the tutorial, 15.4, looks like we did fix this issue back then. I have a PR upgrading the tutorial version. I’ll try to merge it soon.

1 Like

After doing a few tricks, was able to force upgrade to v 16 and run the code. Commands that forced upgrade to 16:

pnpm add next@canary react@latest react-dom@latest eslint-config-next@canary

which resulted in a few deprecated packages but am able to compile.

6 deprecated subdependencies found: are-we-there-yet@2.0.0, gauge@3.0.2, glob@7.2.3, inflight@1.0.6, npmlog@5.0.1, rimraf@3.0.2

Thanks for the follow up.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.