我有一个React-native应用程序,它不使用expo。我收到以下错误:
React Native version mismatch.
│
│ JavaScript version: 0.57.7
│ Native version: 0.61.5
│
└ Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.
我已完成this question中提到的所有内容到目前为止,没有任何效果。
我已将react-native版本更新为0.61.5。它已安装,并且在package.json中也有提及。我还更新了packages.json中的所有软件包。
该项目还使用反应导航。在节点模块的@ react-navigation文件中的native / package.json文件中,这是在devDependencies下提到"react-native": "^0.57.7"
的唯一位置。我已经安装了最新的反应导航4.0.10
。
为防止出现此问题,您应该在android/app/build.gradle
文件中强制使用React Native版本
compile("com.facebook.react:react-native:0.61.5") { force = true }
根据您的本机版本更改0.57.7。