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


当前回答

对于我的用例,我必须删除node_modules目录并运行npm install。

$ rm -rf node_modules   (make sure you're in the ios project directory)
$ npm install

如果你得到错误“dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58。Dylib”,执行以下操作:

$ brew uninstall --force node --ignore-dependencies node
$ brew uninstall icu4c --ignore-dependencies icu4c
$ brew install icu4c
$ brew unlink icu4c && brew link icu4c --force
$ brew install node

$ npm install

其他回答

如果像我一样,您有一个在终端会话(.bashrc/.bash_profile)启动时执行的命令集,它等待输入(在我的例子中,是SSH Key的密码短语,带SSH -add),那么您将注意到它实际上阻止打开的终端启动Metro服务器!

尝试在启动时禁用该命令(或者至少在React Native打开的终端中禁用)。这对我很管用!

检查您的主机,127.0.0.1 localhost没有被删除 检查网络代理是否未设置 然后NPM install & react-native升级重置你的项目

如错误信息所示:

同意Xcode/iOS许可证需要管理员权限,请运行"sudo xcodebuild -license",然后重试此命令。

执行以下命令成功:

sudo xcodebuild -license

另一件对我有用的事情是,在xcode中打开项目,然后清理并构建它。通常它会重新运行打包服务器并解决问题。

我也有同样的问题。但我的问题是我的Mac和iPhone不在同一个wifi网络中。

因此,确保它们都在同一个网络中,并再次重建。如果不是这样,试试其他成员在这里提到的解决方案。