升级React Native后出现捆绑失败错误

时间:2019-05-07 18:21:41

标签: react-native npm

在研究如何模拟AsyncStorage进行测试时,我发现应该使用react-community版本,而不是从react-native导入(尽管从react-native导入)似乎没有任何警告或其他任何情况都可以正常工作。

yarn add @react-native-community/async-storage很好,但是react-native link @react-native-community/async-storage无法正常工作,所以我在某个地方跟随了一个答案并运行了react-native-git-upgrade,然后我就可以链接了。

但是,现在我的应用无法运行:

error: bundling failed: Error: Unable to resolve module `react-native/Libraries/Components/View/ViewStylePropTypes` from `/Users/TuzMacbookPro2017/Development/QMG-local/APPS/ELECTRO/node_modules/react-native-reanimated/src/createAnimatedComponent.js`: Module `react-native/Libraries/Components/View/ViewStylePropTypes` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968

我在互联网上看到PropTypes(我从不使用自己)在某些依赖项中被使用,但已被弃用或移动。当然,它之前没有任何问题。

以下是我尝试修复的各种方法,但无济于事:

  1. npm update
  2. npm audit fix-说“ react”和“ react-native”缺失,所以:
  3. npm i
  4. npm audit fix-运行
  5. (尝试应用:运行时出现相同的原型错误)
  6. sudo npm cache verify
  7. (尝试应用:相同错误)
  8. rm -rf node_modules && yarn install && rm -rf $TMPDIR/react* && npm start --reset-cache
  9. (尝试应用:相同错误)

如果有什么用,这是我的package.json文件

{
  "name": "Electro",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo",
    "testEnvironment": "node"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "@react-native-community/async-storage": "^1.3.4",
    "expo": "^32.0.0",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "^0.59.6",
    "react-native-elements": "^1.1.0",
    "react-native-geocoding": "^0.3.0",
    "react-native-global-font": "^1.0.2",
    "react-native-indicators": "^0.13.0",
    "react-native-keyboard-aware-scrollview": "^2.0.0",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-render-html": "^4.1.2",
    "react-native-uuid": "^1.4.9",
    "react-navigation": "^3.9.1",
    "react-redux": "^6.0.1",
    "redux": "^4.0.1",
    "redux-test-utils": "^0.3.0",
    "redux-thunk": "^2.3.0",
    "sugar": "^2.0.6"
  },
  "devDependencies": {
    "babel-preset-expo": "^5.0.0",
    "enzyme": "^3.9.0",
    "enzyme-adapter-react-16": "^1.12.1",
    "jest": "^24.8.0",
    "jest-expo": "^32.0.0",
    "jsdom": "^14.1.0",
    "mock-async-storage": "^2.1.0",
    "react-test-renderer": "^16.8.6",
    "redux-mock-store": "^1.5.3"
  },
  "private": true,
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}

有人知道如何让我的应用再次运行吗??? (即使还原最后的提交也不起作用!我将尝试降级本机响应...)

1 个答案:

答案 0 :(得分:0)

通过还原提交,最终我能够使我的应用再次运行,然后将react-native的版本由package.json更改回0.57