Next.js Discord

Discord Forum

Next.JS tutorial chapter 1 localStorage error

Answered
IN?AR posted this in #help-forum
Open in Discord
hi i have stated the tutorial (https://nextjs.org/learn/dashboard-app/getting-started) but when i run pnpm run dev i get this error

@ dev **/next-js/nextjs-dashboard
next dev --turbopack

▲ Next.js 15.3.2 (Turbopack)
- Local: http://localhost:3000
- Network: http://192.168.0.110:3000

✓ Starting...
✓ Ready in 1316ms
○ Compiling / ...
✓ Compiled / in 3.8s
(node:74000) 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: '1943459719'
}
[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]
[TypeError: localStorage.getItem is not a function]
⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function]
⨯ unhandledRejection: [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]
[TypeError: localStorage.getItem is not a function] { page: '/' }
[TypeError: localStorage.getItem is not a function]
⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function]
⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function]
GET / 500 in 7964ms
GET / 500 in 66ms

thank you for your help 🙂
Answered by alfonsüs ardani
just change "next":"15.5.6" , save, then run pnpm i (without next@latest)
View full answer

40 Replies

@IN?AR hi i have stated the tutorial (https://nextjs.org/learn/dashboard-app/getting-started) but when i run `pnpm run dev` i get this error > @ dev ****/next-js/nextjs-dashboard > next dev --turbopack > > ▲ Next.js 15.3.2 (Turbopack) > - Local: http://localhost:3000 > - Network: http://192.168.0.110:3000 > > ✓ Starting... > ✓ Ready in 1316ms > ○ Compiling / ... > ✓ Compiled / in 3.8s > (node:74000) 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: '1943459719' > } > [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] > [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [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] > [TypeError: localStorage.getItem is not a function] { page: '/' } > [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > GET / 500 in 7964ms > GET / 500 in 66ms thank you for your help 🙂
what is your code? please send more information
I havent changed the code after i used

npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example" --use-pnpm
@IN?AR hi i have stated the tutorial (https://nextjs.org/learn/dashboard-app/getting-started) but when i run `pnpm run dev` i get this error > @ dev ****/next-js/nextjs-dashboard > next dev --turbopack > > ▲ Next.js 15.3.2 (Turbopack) > - Local: http://localhost:3000 > - Network: http://192.168.0.110:3000 > > ✓ Starting... > ✓ Ready in 1316ms > ○ Compiling / ... > ✓ Compiled / in 3.8s > (node:74000) 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: '1943459719' > } > [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] > [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [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] > [TypeError: localStorage.getItem is not a function] { page: '/' } > [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > ⨯ unhandledRejection: [TypeError: localStorage.getItem is not a function] > GET / 500 in 7964ms > GET / 500 in 66ms thank you for your help 🙂
can you send npx next info
@alfonsüs ardani can you send `npx next info`
/bin/sh: line 1: yarn: command not found Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Fri, 17 Oct 2025 13:29:06 +0000 Available memory (MB): 15910 Available CPU cores: 4 Binaries: Node: 25.0.0 npm: 11.6.2 Yarn: N/A pnpm: 10.18.3 Relevant Packages: next: 15.3.2 // There is a newer version (15.5.6) available, upgrade recommended! eslint-config-next: N/A react: 19.1.0 react-dom: 19.1.0 typescript: 5.7.3 Next.js Config: output: N/A ⚠ There is a newer version (15.5.6) available, upgrade recommended! Please try the latest canary version (npm install next@canary) to confirm the issue still exists before creating a new issue. Read more - https://nextjs.org/docs/messages/opening-an-issue
the learn repository, or maybe perhaps next 15.3.2 doesnt yet support node 25
i was able to get it working in node 22
should i change it in package.json
try nvm i 24 then nvm use 24 then pnpm run dev again
nextjs-dashboard master ❯ nvm i 24
bash: command not found: nvm
u have to install nvm, to manage node versions
I tried updating next.js version and it works too
so you can also do pnpm i next@latest and re-run pnpm dev
if you dont want to uninstall nvm
can you... send pnpm next info ?
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
/bin/sh: line 1: yarn: command not found

Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Fri, 17 Oct 2025 13:29:06 +0000
Available memory (MB): 15910
Available CPU cores: 4
Binaries:
Node: 25.0.0
npm: 11.6.2
Yarn: N/A
pnpm: 10.18.3
Relevant Packages:
next: 15.3.2 // There is a newer version (15.5.6) available, upgrade recommended!
eslint-config-next: N/A
react: 19.1.0
react-dom: 19.1.0
typescript: 5.7.3
Next.js Config:
output: N/A
⚠ There is a newer version (15.5.6) available, upgrade recommended!
Please try the latest canary version (npm install next@canary) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue
what happen when you run pnpm i next@latest ?
WARN  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 Already up to date Progress: resolved 237, reused 212, downloaded 1, added 0, done Done in 1.8s using pnpm v10.18.3
thats weird 😭
i know i might just leave it and learn by doing 🤣
thank you for your help though
what im intending to do is update next version to 15.5.6
you can change the version in the package.json into 15.5.6
and re-run pnpm i
pnpm i next@latest is just a quicker way to do it
i changed it in package.json but still the same error
then ran pnpm i next@latest and then ran it again same error 😭
is it possible to send me a screenshot?
of the terminal?
of the workspace
so i can tell if its in the right directory
ohh dont run pnpm i next@latest after you changed it to 15.5.6
since it will override package.json
just change "next":"15.5.6" , save, then run pnpm i (without next@latest)
Answer
😭
omg thank you so much
it works
yay, good luck with learning
thank you 🙂