Search code examples
iosreact-nativereferenceerror

React Native: run-ios has stopped working (ReferenceError)


I've run into an issue when running the run-ios command. Prior to now, the app started up fine, but now I'm running into this screen before the app even finishes bundling.

Here's a link to the screen I'm getting: https://d17oy1vhnax1f7.cloudfront.net/items/1J3n3u1z3w2k2E160V1B/Screen%20Shot%202017-01-18%20at%2010.36.08%20AM.png?v=783d1021

Here are some of the steps I've gone through to debug the problem:

  • Reset the cache on startup with npm start --reset-cache
  • Cleared the watchman config
  • Enabled remote debugging to pause on caught exceptions*
  • Created a new branch for a previous commit that I know had worked prior to this issue (no resolution)
  • Removed and reinstalled my node_modules folder
  • Removed and reinstalled watchman through homebrew
  • Cleared npm cache
  • Upgraded react-native to 0.40.0

*This is the line where the error is catching on when inspecting in chrome:

global = DedicatedWorkerGlobalScope {console: Object, __fbBatchedBridgeConfig: Object, __DEV_

I've tried a number of solutions in a number of issues but haven't been able to come up with the right solution.

Here's some possibly relevant information:

run-ios startup log:

Found Xcode project TipHiveMobile.xcodeproj
Launching iPhone 6 (iOS 10.2)...
Building using "xcodebuild -project TipHiveMobile.xcodeproj -   configuration Debug -scheme TipHiveMobile -destination id=DDBF9D1C-CB3F-   4FCF-B9B6-C7AF372B7F3E -derivedDataPath build"
User defaults from command line:

IDEDerivedDataPathOverride = /Users/tylerreckart/Code/tiphive/TipHiveMobile/ios/build


=== BUILD TARGET RNVectorIcons OF PROJECT RNVectorIcons WITH CONFIGURATION Debug ===

log-ios output on reload

Jan 18 10:45:05 Nosferatu logd[30752] <Notice>: metadata shared cached  uuid is null (using logd's shared cache info) nsurlstoraged (39014)

Jan 18 10:45:05 Nosferatu logd[30752] <Notice>: Failed to harvest strings for pathless uuid '00000000-0000-0000-0000-000000000000'

Jan 18 10:45:15 Nosferatu TipHiveMobile[31100] <Notice>: Initializing <RCTBatchedBridge: 0x608000199300> (parent: <RCTBridge: 0x6000000a28e0>, executor: RCTWebSocketExecutor)

Jan 18 10:45:15 Nosferatu TipHiveMobile[31100] <Warning>: Required dispatch_sync to load constants for RCTSourceCode. This may lead to deadlocks

Jan 18 10:50:33 Nosferatu routined[30747] <Error>: CoreLocation: Error occurred while trying to retrieve motion state update: CMErrorDomain Code:104
  • React Native version: 0.39.0
  • Platform: iOS
  • Operating System: MacOS

Solution

  • Well I feel like a complete idiot, but the solution here was just to restart my computer. There must have been a leftover process running that was interfering with the way things were bundling.

    For your entertainment: https://media.giphy.com/media/F7yLXA5fJ5sLC/giphy.gif