-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Hello, per https://nextjs.org/learn/dashboard-app/getting-started, upon running pnpm dev
with node.js
version 22+ I would see the following error when visiting localhost:3000
:
$ pnpm dev
> @ dev ~/nextjs-dashboard
> next dev --turbopack
▲ Next.js 15.3.2 (Turbopack)
- Local: http://localhost:3000
- Network: http://10.255.255.254:3000
✓ Starting...
✓ Ready in 947ms
○ Compiling / ...
✓ Compiled / in 1770ms
(node:3412) 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: '3418726375'
}
when downgrading node.js
as follows, I am able to compile and observe 200 code returned:
fnm install 20
fnm use 20
npm install -g pnpm #reinstall pnpm needed
$ pnpm dev
> @ dev ~/nextjs-dashboard
> next dev --turbopack
▲ Next.js 15.3.2 (Turbopack)
- Local: http://localhost:3000
- Network: http://10.255.255.254:3000
✓ Starting...
✓ Ready in 1379ms
○ Compiling / ...
✓ Compiled / in 1904ms
GET / 200 in 2233ms
I think the issue is related to node.js
v22 introducing localStorage
API, which is controlled with --localstorage-file
flag.
grepping for --localstorage-file
returns:
./node_modules/@types/node/globals.d.ts: * unencrypted in the file specified by the `--localstorage-file` CLI flag.
And then since node isnt started with --localstorage-file=somepath
, localStorage.getItem
throws (not a function)
Metadata
Metadata
Assignees
Labels
No labels