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


当前回答

确保你的项目中有.jsbundle

Add

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

在react原生代码中 尝试重新打开项目

其他回答

我在捆绑应用程序时也遇到了同样的问题。 检查一下你的主电源。jsbundle是针对你的主项目的

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

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

检查你的网络代理,最好关闭它。

或者你应该找其他方法来维护打包服务器

我尝试了下面所有的解决方案,但都不起作用:

Sudo xcodebuild -license或 使用rm -r build删除build文件夹并运行react-native run-ios或 NPM启动并运行react-native run-ios 添加NSAppTransportSecurity到localhost

我是这样解决的:

打开主机文件sudo vi /private/etc/hosts(如果你使用VSCode,使用这个sudo code /private/etc/hosts) 如果不存在,添加三行

127.0.0.1 localhost
255.255.255.255 localhost
::1 localhost

再次运行react-native Run -ios。

以下步骤:

用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