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


当前回答

好吧,这听起来可能很奇怪,但这些答案对我都没用。 我现在在react-native 0.60,问题发生在ios和android上。 对我来说唯一有效的解决办法就是跑步 React-native run-ios或React-native run-android 然后,当出现错误时,运行 npm install(保持捆绑器和模拟器打开) 然后运行react-native run-ios或react-native run-android

其他回答

是什么帮我解决了这个问题:

打开终端窗口 cd到YOUR_PROJECT/ios 使用rm -r build删除build文件夹 再次运行react-native Run -ios

或者,你可以打开Finder,导航到YOUR_PROJECT/ios并删除构建文件夹。

然后再次运行react-native run-ios。

资料来源:Andrew Bancroft

执行如下命令:

killall -9 node
rm -rf ios/build
react-native run-ios

它将打开launchpacker .command,应用程序将安装在ios模拟器上

只需在终端react-native启动:

cd your react native app directory/ react-native start 

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

以下步骤:

用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

我是这样做的:

打开终端窗口 cd到YOUR_PROJECT/ios 使用rm -r build删除build文件夹 再次运行react-native Run -ios