Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReferenceError: Can't find variable: localStorage] #35974

Closed
KiranRadish opened this issue Jan 26, 2023 · 2 comments
Closed

[ReferenceError: Can't find variable: localStorage] #35974

KiranRadish opened this issue Jan 26, 2023 · 2 comments

Comments

@KiranRadish
Copy link

Description

while running the app it throws [ReferenceError: Can't find variable: localStorage]

Version

"react-native": "0.66.4",

Output of npx react-native info

System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1
Memory: 75.59 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.5.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 9.3.1 - /opt/homebrew/bin/npm
Watchman: 2023.01.23.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 23, 29, 30, 31, 32, 33
Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
System Images: android-29 | Google Play ARM 64 v8a, android-30 | Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-32 | Google APIs ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

eveytime when i call API and store it in context it throws [ReferenceError: Can't find variable: localStorage]

Snack, code example, screenshot, or link to a repository

not sure what code affecting this because
localStorage is nowhere added in code

@iBotPeaches
Copy link
Contributor

My guess is you probably have a package that is meant for web. You could polyfill it, but I wouldn't do that. Look at what packages you've installed recently or using. You might have to configure a driver for storage using async storage or something.

You want to upgrade React Native additionally. You won't get any support here until you get up to at least RN69 - https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported

@cortinico
Copy link
Contributor

You want to upgrade React Native additionally. You won't get any support here until you get up to at least RN69 - reactwg/react-native-releases#which-versions-are-currently-supported

Thanks for sharing thsi @iBotPeaches
I'm going to close this as 0.66 is not currently supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants