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


当前回答

我知道这个问题有很多答案,但这些都没有帮助我。下面的解决方案帮助我解决了这个错误。

你必须进入你的设置,允许这个特定的应用程序。

打开系统首选项。 点击“安全与隐私”。 底部右键单击“点击锁进行更改”。 输入密码。 在general标签下,它说“应用商店和已识别的开发者”,你应该看到你被阻止的应用。 最后一步:点击“无论如何打开”

无法打开源“launchpacker .command”,因为它来自未识别的开发人员

其他回答

解决错误No bundle URL present by:

在你的项目根目录中运行以下命令删除iOS构建目录,并在重新构建之前杀死其他React Native会话(假设它们运行在默认端口8081上):

Rm -rf ios/build/;Kill $(lsof -t:8081);react-native run-ios

更新你的React Native工作流,通过将上述命令组合成一个别名,并将其附加到你的Bash配置文件.bashrc,以避免这些错误发生:

Echo "alias rni=\"kill \$(lsof -t -i:8081);Rm -rf ios/build/;React-native run-ios\"" >> ~/.bashrc;源~ / . bashrc

现在你可以用一个简单的别名快捷方式运行React Native iOS构建(不用担心出现一些常见的红色死亡错误屏幕):

rni

步骤1: 在xcode中打开。xcodeworkspace项目,通过“Terminal”导航, “开放/ ios /。xcodeworkspace"按Enter键。

步骤2: 删除主机。Jsbundle文件

步骤3: 回到VS Code,输入这个, React-native bundle——entry-file index.js——platform ios——dev false——bundle-output ios/main。Jsbundle——assets-dest ios

这将生成新的主线。jsbundle文件。

步骤4: react-native run-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。

以下步骤:

用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为我工作。在控制台中有一个警告,它没有被捆绑。