Reputation: 1045
When trying to run a react native iOS App, I am getting a red page with an error. This is the following error I am getting on the iOS screen.
Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module ./node_modules/react-native/src/constants/screens from/Users/username/Desktop/mobile/App.js: The module ./node_modules/react-native/src/constants/screens could not be found from /Users/username/Desktop/mobile/App.js. Indeed, none of these files exist:
/Users/username/Desktop/mobile/node_modules/react-native/src/constants/screens(.native||.ios.jsx|.native.jsx|.jsx|.ios.js|.native.js|.js|.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
/Users/username/Desktop/mobile/node_modules/react-native/src/constants/screens/index(.native||.ios.jsx|.native.jsx|.jsx|.ios.js|.native.js|.js|.ios.js|.native.js|.js|.ios.json|.native.json|.json) (null))
__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.245
RCTCxxBridge.mm:420
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
_dispatch_client_callout
_dispatch_block_invoke_direct
_dispatch_client_callout
_dispatch_block_invoke_direct
dispatch_block_perform
__NSOQSchedule_f
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread
I tried resolving this issue by looking at other stackoverflow posts. However, none of the solutions worked for me so far. I am honestly confused and don't know what to do. Any help or suggestions are appreciated.
Upvotes: 4
Views: 2794
Reputation: 177
Quick fix: npm add @babel/runtime
then: rm -rf ios/build/; kill $(lsof -t -i:8081); react-native run-ios
Upvotes: 5