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


当前回答

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

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

其他回答

执行如下命令:

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

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

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

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

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

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

资料来源:Andrew Bancroft

使用命令

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

这是react-native v0.42.1的一个问题。尝试关闭所有终端和XCode实例并运行:

launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
watchman version
react-native run-ios

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

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