React Native Ios 错误“无法加载包"

React Native Ios 错误“无法加载包

问题描述:

我想开始学习 React-Native

I want to start learn React-Native

react-native init
react-native run-ios

我已经尝试了四种图像方法

I have tried four methods of image

我尝试了上述所有解决方案,但都没有奏效.但是这个解决方案适用于我的情况(React-Native 0.57.2):

I tried all the solutions above, but none worked. But this solution works in my case (React-Native 0.57.2) :

https://github.com/facebook/react-native/issues/21490#issuecomment-427240356

1.关闭所有正在运行的 Metro Bundler

1.Close all Metro Bundler running

2.清理缓存

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

3.新建项目并安装babel runtime

3.Create a new project and install babel runtime

react-native init awesomeproject
cd awesomeproject
npm install --save-dev @babel/runtime

3.在你的终端中启动 Metro Bundler(不要关闭它)

3.Start Metro Bundler in your terminal (don't close it)

react-native start

4.在终端中打开一个新窗口,然后运行您的应用

4.Open a new window in your terminal,and run your app

react-native run-ios