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


当前回答

以下步骤:

用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

其他回答

export FORCE_BUNDLING=true为我工作。在控制台中有一个警告,它没有被捆绑。

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

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。

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

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

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

首先关闭模拟器,然后在终端上运行这些程序

npm install

react-native run-ios

关闭模拟器和终端。打开一个新的并进入你的项目,然后像这样升级你的react-native:

react-native upgrade

问题:当bundle执行失败时,RCTFatal中的无限递归。