-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Describe the bug
When creating an app using pnpm create refine-app@latest, and opting to create a Next.js application with shadcn for UI components, after attempting to start the app via pnpm dev and accessing the homepage at http://localhost:3000, the page fails to load with a 500 server error.
The terminal logs indicate that this is due to a unhandledRejection occurring due to a TypeError being thrown: specifically, the logs indicate this is due to localStorage.getItem not being considered a function ([TypeError: localStorage.getItem is not a function]).
When searching through the generated template codebase, I could only find one instance where localStorage.getItem was referenced: in src/components/refine-ui/theme/theme-provider.tsx. Commenting this usage of localStorage.getItem out does not resolve the issue.
Steps To Reproduce
- Run
pnpm create refine-app@latestto begin the new Refine app template wizard. - Select "Next.js" for the project template.
- Name the project.
- Select "REST API" as the data provider.
- Select "shadcn/ui" as the UI framework.
- Select "Yes" for example pages to be added.
- Select "None" for the auth provider.
- Select "pnpm" for the package manager.
- Skip adding an email.
- Navigate to the generate project directory, run
pnpm dev, and in the browser, navigate tohttp://localhost:3000. - You should see that the page fails to load with a 500 error, and the terminal will show that this is due to a
[TypeError: localStorage.getItem is not a function]occurring when compiling pages. - Comment out any reference to
localStorageinsrc/components/refine-ui/theme/theme-provider.tsx, and save this file. - Close and restart the server (with
pnpm dev), and navigate tohttp://localhost:3000. - You should still see the same 500 error page in the browser, and the same error messages in the terminal logs.
Expected behavior
The app should launch without any errors, and I should be able to access the template admin panel in the browser to play around with the app.
Packages
System:
- OS: macOS 15.7.3
- CPU: (14) arm64 Apple M4 Pro
Binaries:
- Node: 25.2.1 - /opt/homebrew/bin/node
- Yarn: Not Found
- npm: 11.6.2 - /opt/homebrew/bin/npm
Browsers:
- Chrome: Not Found
- Firefox: 146.0.1
- Safari: 26.2
Refine Packages:
- @refinedev/cli: 2.16.50
- @refinedev/core: 5.0.7
- @refinedev/devtools: 2.0.3
- @refinedev/kbar: 2.0.1
- @refinedev/nextjs-router: 7.0.4
- @refinedev/react-hook-form: 5.0.3
- @refinedev/react-router: 2.0.3
- @refinedev/react-table: 6.0.1
- @refinedev/simple-rest: 6.0.
Additional Context
The terminal log after running the app with pnpm dev:
✓ Ready in 1959ms
○ Compiling / ...
✓ Compiled / in 2.2s (1583 modules)
⨯ [TypeError: localStorage.getItem is not a function] {
digest: '9055150'
}
[TypeError: localStorage.getItem is not a function]
⨯ [TypeError: localStorage.getItem is not a function] { page: '/' }
(node:91012) Warning: `--localstorage-file` was provided without a valid path
(Use `node --trace-warnings ...` to show where the warning was created)
○ Compiling /_error ...
✓ Compiled /_error in 1028ms (1917 modules)
[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 5092ms
GET / 500 in 212ms
✓ Compiled /_not-found in 436ms (1907 modules)
⨯ [TypeError: localStorage.getItem is not a function] {
digest: '9055150'
}
[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]
[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]
GET /init 500 in 1001ms
GET /init 500 in 239ms
✓ Compiled in 194ms (1061 modules)