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


当前回答

我是这样做的:

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

其他回答

...发生这种情况的另一个原因是,如果你已经安装了Visual Studio Code React Native Tools,但你一直试图在终端中使用React Native:它第一次会工作,但随后它会停止并显示红色的no bundle屏幕。

从vscode启动react native工作得很好…

以下步骤:

用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

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

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

我不得不在一个单独的终端上运行“react-native start”。由于某种原因,它不运行了

编辑:另外,这是必要的,因为文件权限设置不正确。我能够通过在受影响的项目目录中运行以下命令来修复它。

chmod 777 node_modules/react-native/scripts/ launchpacker .command

我是这样做的:

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