当我初始化一个新项目,然后启动Xcode模拟器时,得到以下消息:

React-Native版本不匹配 Javascript版本0.50.1 本机版本:0.50.0 确保您已经重新构建了本机代码. ...

有谁知道这是怎么回事能帮帮我吗?


当前回答

这对我很有效

博览会更新39.0.0 -npm

因为我的expo版本是38(Check in package.json)。

其他回答

当你试图在不关闭节点服务器的情况下运行前一个应用程序时,有时会发生这种情况,所以尝试重新启动React。要做到这一点,只需运行以下命令:

1. To kill current processes
killall node -9 

2. To Start React  Native
react-native start 

3. Then Run android
react-native run-android

在你的构建中。Gradle文件添加以下内容

implementation ("com.facebook.react:react-native:0.51.0") {
    force = true;
}

将0.51.0替换为package.json中的版本

我试图从WebStorm中构建和运行一个React Native应用程序,然后遇到了这个问题。对我来说,简单的解决方案是:

watchman watch-del-all

在macOS上,如果watchman还没有安装,请使用Homebrew安装:

brew install watchman

我更新了react-native版本:0.57.4到0.59.8,我得到以下消息“react-native版本不匹配”

这个解决方案对我来说很有效:

1.- In the folder of the project, update all the code react-native in the Android Studio:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

2.- Go to Android Studio and FILE->>INVALIDATE CACHES/RESTART
3.- In Android Studio, BUILD->>CLEAN PROJECT
4.- In Android Studio, BUILD->>REBUILD PROJECT
5.- Delete App in simulator or Devices
6.- Run...

希望对大家有所帮助!

这不是一个解决方案,但在我的情况下,我在我的设备上安装了多个RN应用程序,我不知情地试图从错误的应用程序中“重新加载”。(我正在同时开发两个应用程序)所以确保你在正确的应用程序!