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


当前回答

也许你忘了这一步

cd ios && pod install

其他回答

关闭当前正在运行的React Packager终端窗口,然后从Xcode重新运行你的iOS项目应该可以工作。

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

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。

关闭全局代理(shadowsocks)

在info.plist中的NSExceptionDomains字典中检查你的“localhost”键

如果它不存在,就会导致错误。

只需在终端react-native启动:

cd your react native app directory/ react-native start 

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