Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 在全新项目中升级到0.61.1后应对本机版本不匹配_React Native - Fatal编程技术网

React native 在全新项目中升级到0.61.1后应对本机版本不匹配

React native 在全新项目中升级到0.61.1后应对本机版本不匹配,react-native,React Native,我正在将React本机应用程序从0.59升级到0.61。我所做的是用react原生init emps_fe6从头开始生成一个全新的项目,并在package.json中添加每个模块。同时将组件和App.js复制到新项目中。这是我的新package.json文件: 然后使用react native run Android启动Android emulator。它抛出版本不匹配的错误: 我不太明白是什么原因导致了这个错误,因为components和App.js中没有提到版本0.59.9。该项目从全新开始

我正在将React本机应用程序从0.59升级到0.61。我所做的是用react原生init emps_fe6从头开始生成一个全新的项目,并在package.json中添加每个模块。同时将组件和App.js复制到新项目中。这是我的新package.json文件:

然后使用react native run Android启动Android emulator。它抛出版本不匹配的错误:


我不太明白是什么原因导致了这个错误,因为components和App.js中没有提到版本0.59.9。该项目从全新开始,每个模块都是单独添加的。以前版本中唯一的东西是组件和App.js。

可能是因为metro bundler运行的是以前版本的React Native,这导致了此问题。因此,当我面临这个问题时,我通常会启动捆绑程序,比如npm启动-重置缓存。确保停止任何metro捆绑机的运行


如果问题仍然存在,请尝试重新启动您的计算机。

在我的情况下,这只工作一次,当版本不匹配错误消失时,我会得到此信息。一旦我再次说react native run ios,错误就会再次出现。。
{
  "name": "emps_fe6",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.24.0",
    "react": "16.9.0",
    "react-native": "0.61.1",
    "react-native-cli": "^2.0.1",
    "react-native-confirmation-code-field": "^3.9.0",
    "react-native-device-info": "^3.1.4",
    "react-native-elements": "^1.2.3",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-gifted-chat": "^0.10.1",
    "react-native-keychain": "^4.0.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.4.0",
    "react-native-modal-datetime-picker": "^7.6.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-vector-icons": "^6.6.0",
    "react-navigation": "^4.0.10",
    "socket.io-client": "2.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}