从 60.4 升级到 59.5 时 React Native 版本不匹配
React Native version mismatch when upgrading from 59.5 from 60.4
按照 https://react-native-community.github.io/upgrade-helper/ 上的所有说明升级到较新版本的 React Native (60.4) 后
但仍然收到此错误消息:
console.error: "React Native version mismatch.
JavaScript version: 0.57.8
Native version: 0.60.4
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'.
Here's a screenshot
重点是我升级前是0.59.5版本
已经尝试过:
- Downgrading to 60.0
- Removing node_modules/
- Removing react-navigation (maybe it was using another version of RN, but it is on version 3.11.1 now)
- Another develop environment
- Deleting entire folder and cloning from remote
- implementation ("com.facebook.react:react-native:0.60.4") { force = true }
这是我的 package.json
依赖项:
"dependencies": {
"@react-native-community/async-storage": "^1.6.1",
"native-base": "^2.13.4",
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-animatable": "^1.3.0",
"react-native-camera": "^3.0.1",
"react-native-firebase": "^5.5.6",
"react-native-gesture-handler": "^1.3.0",
"react-native-masked-text": "^1.12.5",
"react-native-material-menu": "^0.6.6",
"react-native-push-notification": "^3.1.8",
"react-native-qrcode-scanner": "^1.2.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "3.11.1"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@react-native-community/eslint-config": "^0.0.5",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"documentation": "12.1.1",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-native": "^3.7.0",
"flow-bin": "^0.98.0",
"jest": "^24.8.0",
"jetifier": "^1.6.3",
"metro-react-native-babel-preset": "^0.55.0",
"react-test-renderer": "16.8.6"
},
- 节点版本:12.8.0
- 纱线版本:1.17.3
我在尝试 watchman watch-del-all && react-native start --reset-cache
后能够 运行,但所有矢量图标都崩溃了,所有 firebase 分析事件都导致应用程序崩溃。
解决方案是使用 react-native init MyProject
创建一个项目,他们在 package.json
中添加库,但 react-native-vector-icons
仍然需要链接。
唯一的问题是自定义字体根本不起作用!
按照 https://react-native-community.github.io/upgrade-helper/ 上的所有说明升级到较新版本的 React Native (60.4) 后 但仍然收到此错误消息:
console.error: "React Native version mismatch.
JavaScript version: 0.57.8
Native version: 0.60.4
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'.
Here's a screenshot 重点是我升级前是0.59.5版本
已经尝试过:
- Downgrading to 60.0
- Removing node_modules/
- Removing react-navigation (maybe it was using another version of RN, but it is on version 3.11.1 now)
- Another develop environment
- Deleting entire folder and cloning from remote
- implementation ("com.facebook.react:react-native:0.60.4") { force = true }
这是我的 package.json
依赖项:
"dependencies": {
"@react-native-community/async-storage": "^1.6.1",
"native-base": "^2.13.4",
"react": "16.8.6",
"react-native": "0.60.4",
"react-native-animatable": "^1.3.0",
"react-native-camera": "^3.0.1",
"react-native-firebase": "^5.5.6",
"react-native-gesture-handler": "^1.3.0",
"react-native-masked-text": "^1.12.5",
"react-native-material-menu": "^0.6.6",
"react-native-push-notification": "^3.1.8",
"react-native-qrcode-scanner": "^1.2.1",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "3.11.1"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@react-native-community/eslint-config": "^0.0.5",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"documentation": "12.1.1",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-native": "^3.7.0",
"flow-bin": "^0.98.0",
"jest": "^24.8.0",
"jetifier": "^1.6.3",
"metro-react-native-babel-preset": "^0.55.0",
"react-test-renderer": "16.8.6"
},
- 节点版本:12.8.0
- 纱线版本:1.17.3
我在尝试 watchman watch-del-all && react-native start --reset-cache
后能够 运行,但所有矢量图标都崩溃了,所有 firebase 分析事件都导致应用程序崩溃。
解决方案是使用 react-native init MyProject
创建一个项目,他们在 package.json
中添加库,但 react-native-vector-icons
仍然需要链接。
唯一的问题是自定义字体根本不起作用!