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


当前回答

如果您正在运行IOS模拟器,请确保需要运行此命令

react-native运行android 或 npm运行android

一旦你运行以上命令metro bundler将启动,然后运行react- negative run-ios它将工作。

其他回答

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

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

确保launchPackage.command在终端中运行,然后重试运行。它将构建捆绑包。它有点像webpack-dev-server。

对于我的用例,我必须删除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

我是这样做的:

打开终端窗口 cd到YOUR_PROJECT/ios 使用rm -r build删除build文件夹 再次运行react-native Run -ios

试着运行这段代码:

$ sudo xcodebuild -license

这可能会解决问题。这对我很有用。