简体   繁体   English

React Native - 无法在 iOS 中加载包

[英]React Native - Failed to load bundle in iOS

打开应用程序时出现错误屏幕

I am native iOS app developer but i also want to be aware of latest and trending technology so i choose to get my hands on react native.我是本地 iOS 应用程序开发人员,但我也想了解最新和趋势技术,所以我选择动手进行 React Native。 Now, i am getting this error when trying to run my react native created app on iOS.现在,我在尝试在 iOS 上运行我的 React Native 创建的应用程序时遇到此错误。 I enter the command react-native run-ios and simulator started and after that app opened but in starting it showed this screen.我输入命令 react-native run-ios 和模拟器启动,并在该应用程序打开后但在启动时显示此屏幕。

There are couple of solutions available in the link below.下面的链接中提供了几种解决方案。 Please try them.请尝试它们。

https://github.com/facebook/react-native/issues/21310 https://github.com/facebook/react-native/issues/21310

for now after react-native init, since a lot of new changes are coming out, this fix worked for me (I got it from reading other issues):
with npm:
npm install --save-dev @babel/core
npm install --save-dev @babel/runtime
or with yarn:
yarn add --dev @babel/core
yarn add --dev @babel/runtime

if on ios you get _this._registerEvents is not a function, after a successful build
do
npm run start --reset-cache
or
react-native start --reset-cache

For me i got reason for issues that for now since a lot of new changes are coming out like Xcode 10 itself is new and react native is not yet merged with that, this fix worked for me:对我来说,我现在有一些问题的原因,因为很多新的变化正在出现,比如 Xcode 10 本身是新的,而 react native 尚未与它合并,这个修复对我有用:

with npm:使用 npm:

npm install --save @babel/runtime npm install --save @babel/runtime

or with yarn:或用纱线:

yarn add @babel/runtime纱线添加@babel/runtime

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM