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


当前回答

我也遇到过这样的问题……问题是封装器没有运行,似乎可能是因为我的默认shell是zsh。react-native厌倦打开一个新的终端窗口并运行…/node_modules/react-native/packager/ launchpacker .命令,但是这个命令没有运行。手动运行(并保持运行)为我解决了这个问题。

其他回答

以下步骤:

用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

检查你的网络代理,最好关闭它。

或者你应该找其他方法来维护打包服务器

我也有这个屏幕,但我的问题是前一天晚上我一直在使用代理(使用Charles监视来自RN env的网络请求)。

一旦我关闭代理应用程序构建/运行在我的模拟器没有任何问题。

对于我的用例,我必须删除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打开的终端中禁用)。这对我很管用!