当我运行一个react-native项目时,我得到一个错误,没有bundle URL,但我不知道我做了什么错误,我很困惑。


当前回答

以下步骤:

用xcode打开ios文件项目 在项目包中删除main。jsbundle文件 通过main添加新的空文件。jsbundle名字 运行comment: react-native bundle——entry-file index.js——platform ios——dev false——bundle-output ios/main。Jsbundle——assets-dest ios 现在是react-native run-ios

youtube链接:https://www.youtube.com/watch?v=eCs2GsWNkoo

其他回答

使用命令

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/release/main.jsbundle --assets-dest ./ios/release/main.jsbundle

试着运行这段代码:

$ sudo xcodebuild -license

这可能会解决问题。这对我很有用。

只需在终端react-native启动:

cd your react native app directory/ react-native start 

它将启动打包器,现在不要关闭这个终端窗口,在另一个终端窗口运行你的项目。这是我唯一想要的,让它正常工作。

在我的案例中,通过重新启动adb服务器解决了这个问题:adb kill-server && adb start-server

我们通过删除构建脚本中的SKIP_BUNDLING选项来解决这个问题,RN文档建议添加该选项来加快调试构建。真正的修复(为了我们的原因)包含在RN 0.57中:

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