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

Error "ReferenceError: window is not defined" with React Native Web version. #1150

Open
1 of 5 tasks
lucaskraus opened this issue Oct 8, 2024 · 1 comment
Open
1 of 5 tasks
Labels
bug Something isn't working

Comments

@lucaskraus
Copy link

What happened?

I'm trying to use the Web version of my project, but the bundle just stop to running immediately after complete the process with the following error in exit:

/home/lucas/code/Frontend/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js:63
    return createPromise(() => window.localStorage.getItem(key), callback);
                         ^
ReferenceError: window is not defined

Version

2.0.0

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
  OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Memory: 9.21 GB / 15.51 GB
  Shell:
    version: 5.1.16
    path: /bin/bash
Binaries:
  Node:
    version: 20.15.1
    path: ~/.nvm/versions/node/v20.15.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v20.15.1/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: javac 22
    path: /home/lucas/.sdkman/candidates/java/current/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to Reproduce

  • create a new project
  • install @react-native-async-storage/async-storage version 2.0.0
  • try to run web version
@lucaskraus lucaskraus added the bug Something isn't working label Oct 8, 2024
@hoahv20
Copy link

hoahv20 commented Oct 15, 2024

same issue. I was downgrade to version 1.23.1 but it's still occur

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants