简体   繁体   English

React Native:无法在iOS上正确运行app“无法加载bundle(http:// localhost:8081 / index.bundle?”

[英]React Native: Can't run app on iOS correctly “Failed to load bundle(http://localhost:8081/index.bundle?”

When trying to run a react native iOS App, I am getting a red page with an error. 在尝试运行本机iOS应用程序时,我收到一个错误的红页。 This is the following error I am getting on the iOS screen. 这是我在iOS屏幕上得到的以下错误。

 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. 我试着通过查看其他stackoverflow帖子来解决这个问题。 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. 任何帮助或建议表示赞赏。

Quick fix: npm add @babel/runtime 快速修复:npm add @ babel / runtime

then: rm -rf ios/build/; 那么:rm -rf ios / build /; kill $(lsof -t -i:8081); 杀$(lsof -t -i:8081); react-native run-ios 反应原生的run-ios

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React Native - 捕获到奇怪的错误 - {&quot;line&quot;:25722,&quot;column&quot;:33,&quot;sourceURL&quot;:&quot;http://10.0.2.2:8081/index.bundle?platform=android&amp;dev=true&amp;minify= - React Native - Strange error caught - {"line":25722,"column":33,"sourceURL":"http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify= Can't run React Native App on iOS with error No bundle URL present - Can't run React Native App on iOS with error No bundle URL present React-Native Android无法加载js包:index.android.js中的更改无法在apk中看到 - React-native android failed to load js bundle:Changes in index.android.js can't see in apk 对本机样板感到满意-无法加载捆绑包 - Contentful with react native boilerplate - failed to load bundle React &amp; Webpack:加载失败<script> with source http://localhost:8080/app/bundle.js - React & Webpack: Loading failed for the <script> with source http://localhost:8080/app/bundle.js 如何在真实设备上捆绑和部署React-Native iOS应用 - How to bundle and deploy React-Native iOS app on real device android build 上的 React Native App 显示“无法从 assets&#39;index.android.bundle&#39; 加载脚本”需要重新启动系统 - React Native App on android build says "Unable to load script from assets'index.android.bundle' " requires a system restart 在React Native中添加本机基本导入时无法加载捆绑包错误 - Failed to load bundle error when adding native base import in react native 本地主机节点服务器无法从Webpack加载bundle.js - localhost node server can't load bundle.js from webpack React Native:“构建 JavaScript 包失败。 无法从“App.js”解析“@react-navigation/stack” - React native: “Failed building JavaScript bundle. Unable to resolve ”@react-navigation/stack“ from ”App.js“”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM