React本机版本不匹配:本机版本:0.61.5,javascript版本:0.57.7

时间:2020-01-11 07:44:35

标签: android reactjs react-native react-navigation

我有一个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文件中,这是"react-native": "^0.57.7"在devDependencies下唯一提及的地方。我已经安装了最新的反应导航4.0.10

1 个答案:

答案 0 :(得分:0)

为防止出现此问题,您应在android/app/build.gradle文件中强制使用React Native版本

compile("com.facebook.react:react-native:0.61.5") { force = true }

根据您的本机版本更改0.57.7。