React Native Version Mismatch

2019-01-13 01:50发布

Getting the following message when i init a new project and then launch the x-code emulator. "React-Native Version Mismatch" Javascript Version 0.50.1 Native version: 0.50.0

Make sure you have rebuilt the native code...

Does anyone know what is going on here and can help me?

Thanks!

enter image description here

26条回答
混吃等死
2楼-- · 2019-01-13 02:19

Possible Fix:

  1. Delete the package-lock.json
  2. Run: watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/haste-map-react-native-packager-* && rm -rf node_modules/&& npm install

If the problem persists, try to execute the project directly from the Xcode

This worked for me.

查看更多
Luminary・发光体
3楼-- · 2019-01-13 02:20

This is what I've done with it:

Close all terminals and run build again.

You may forgot to close nodejs terminal from another project, and they happen to have installed different react version.

So the code fetch from nodejs server conflicts with native one.

查看更多
仙女界的扛把子
4楼-- · 2019-01-13 02:20

I have got the same issue while building my react native app for android and I did the following which worked for me.

The "JavaScript version 0.50.1" in the error console is the react-native version in your package.json file. Make sure it is the same version as "Native version 0.50.0" in the error console.

  1. I have Updated the react-native version to the "Native Version 0.50.0" as prompted in the error console.
  2. Rebuild the app react-native run-android.
查看更多
\"骚年 ilove
5楼-- · 2019-01-13 02:23

For me it was due to react-native version in dependency section of package.json file. It was:

"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.0"
}

I chaged it to:

"dependencies": {
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "0.52.0"
}

Now it works fine.

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-13 02:23

Make sure also that the wifi is enabled in your emulator

查看更多
smile是对你的礼貌
7楼-- · 2019-01-13 02:24

just force react native version in your android's app level gradle file, in the dependencies section.

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

worked for me

查看更多
登录 后发表回答