当我运行一个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

其他回答

我也遇到了这个问题(第一次开始使用React Native)。当一个ios模拟(react-native run-ios)正在运行时,问题消失了。我运行npm install,然后再次运行react-native run-ios。在终端窗口中,它显示正在捆绑,然后模拟器显示欢迎屏幕。

在react-native init PropertyFinder行之后检查这个链接,尝试使用npm start(这对我来说是有效的)

========================================================================

16.9更新

我的端口8081被McAfee阻塞。直接使用不同的端口不能工作react-native start——port=8082和react-native run-ios——port=8082

几乎所有的解都试过了。但是什么都不管用。

        "react": "16.9.0",
        "react-dom": "^16.12.0",
        "react-native": "0.61.5",

解决方案:

在Xcode中搜索8081,并将它们全部替换为8082。然后运行相同的命令来构建和运行应用程序。应用程序运行顺畅

react-native start --port=8082
react-native run-ios --port=8082

我也遇到了同样的问题,我通过在AppDelegate中进行更改来解决它。m文件。我改变了

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

to

jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

这对我来说很有效:)

也许你忘了这一步

cd ios && pod install

使用命令

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/release/main.jsbundle --assets-dest ./ios/release/main.jsbundle

这个问题发生在我身上,因为地铁捆绑机启动并收到焦点,而我正在另一个窗口的键盘上打字。我不小心输入了新打开的终端窗口,导致地铁捆扎机崩溃。重新运行react-native run-ios并耐心等待修复了它。