【发布时间】:2019-05-07 18:21:41
【问题描述】:
在研究如何模拟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(我自己从不使用)在某些依赖项中使用,但已被弃用或移动或其他东西。当然,它之前没有出现任何问题。
以下是我尝试修复的各种问题,但没有任何帮助:
npm update-
npm audit fix- 说 react 和 react-native 缺失,所以: npm i-
npm audit fix- 运行 - (尝试应用:运行时出现相同的 proptypes 错误)
sudo npm cache verify- (试用应用:同样的错误)
rm -rf node_modules && yarn install && rm -rf $TMPDIR/react* && npm start --reset-cache- (试用应用:同样的错误)
如果有任何用处,这是我的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"
]
}
}
有谁知道如何让我的应用再次运行??? (即使恢复最后一次提交也不起作用!我会尝试降级 react native...)
【问题讨论】:
标签: react-native npm