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

undefined is not an object (evaluating 'window.location.href') #48624

Open
sandeepmahajan11 opened this issue Jan 12, 2025 · 7 comments
Open
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: Unsupported Version Issues reported to a version of React Native that is no longer supported

Comments

@sandeepmahajan11
Copy link

Description

I am getting app crash on launch for both the platform android and ios, If I run app in debug mode then it works fine and as soon as removed from debug mode app getting crashed.
I am not getting clear log specific to a library or syntext, only gettine below error.

Error - undefined is not an object (evaluating 'window.location.href')

version - "react-native": "0.72.6",

Steps to reproduce

  1. Install the node_module.
  2. Install the pod.
  3. run the app
  4. after installation it is getting crashed before launch.

React Native Version

0.72.6

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.7.1
  CPU: (10) arm64 Apple M2 Pro
  Memory: 635.34 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: ~/.nvm/versions/node/v20.12.0/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.0/bin/npm
  Watchman:
    version: 2024.04.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /Users/sandeep.mahajan/.rvm/rubies/ruby-2.7.8/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 11.3.7
    wanted: 11.3.7
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: false
  newArchEnabled: false

Stacktrace or Logs

ERROR  TypeError: undefined is not an object (evaluating 'window.location.href')
 WARN  Module BiometricModule requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 WARN  Module RCTBraintreeModule requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 WARN  Module AppAlternateIcon requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 WARN  Module RNDataCollector requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 WARN  Module RNNetPerformComponent requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 LOG  Running "VfMobileapp" with {"rootTag":1,"initialProps":{}}
 ERROR  Invariant Violation: "VfMobileapp" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

Reproducer

aws-amplify/amplify-js#4708

Screenshots and Videos

Simulator Screenshot - iPhone 13 Pro - 2025-01-12 at 16 55 35

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Jan 12, 2025
@react-native-bot
Copy link
Collaborator

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@react-native-bot react-native-bot added Type: Unsupported Version Issues reported to a version of React Native that is no longer supported and removed Needs: Triage 🔍 labels Jan 12, 2025
@react-native-bot
Copy link
Collaborator

Warning

Unsupported version: It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@princektripathi
Copy link
Collaborator

@sandeepmahajan11, window.location.href will not be available in iOS and Android runtimes. It is a property available in web browsers.
https://developer.mozilla.org/en-US/docs/Web/API/Location/href

@sandeepmahajan11
Copy link
Author

sandeepmahajan11 commented Jan 13, 2025 via email

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Jan 13, 2025
@princektripathi
Copy link
Collaborator

@sandeepmahajan11, what is your use case? Also, this space is primarily for issue tracking so I suggest you to leverage platforms like StackOverflow for such discussions.

@sandeepmahajan11
Copy link
Author

sandeepmahajan11 commented Jan 13, 2025

app works fine if I enable debug mode, and when I remove it from debug it got crashed, Not able to even see splash screen, Even I am not getting exact issue?
@princektripathi Could you please help me out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: Unsupported Version Issues reported to a version of React Native that is no longer supported
Projects
None yet
Development

No branches or pull requests

3 participants