当我收到以下流程错误时,我正在配置一个新项目并开始导入一些库。此错误是什么意思以及如何诊断和修复?这是一个 React Native 项目,我最近添加了 subscriptions-transport-ws
库。
Launching Flow server
Spawned flow server (pid=13272)
node_modules/react-native/Libraries/Renderer/src/renderers/shared/stack/event/eventPlugins/TouchHistoryMath.js:0
TouchHistoryMath. Duplicate module provider
current provider. See: node_modules/react-native-gesture-responder/library/TouchHistoryMath.js:0
package.json
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"flow": "node_modules/.bin/flow",
"flow-stop": "node_modules/.bin/flow stop"
},
"dependencies": {
"@shoutem/ui": "^0.10.9",
"apollo-client": "0.8.0",
"graphql": "^0.9.1",
"graphql-tag": "^1.2.4",
"lodash": "^4.17.4",
"react": "~15.4.0",
"react-apollo": "^0.10.1",
"react-native": "0.41.2",
"react-native-lock": "^0.4.0",
"react-redux": "^5.0.2",
"redux": "^3.6.0",
"redux-actions": "^1.2.1",
"redux-persist": "^4.4.0",
"redux-thunk": "^2.2.0",
"subscriptions-transport-ws": "^0.5.1"
},
"devDependencies": {
"babel-eslint": "^7.1.1",
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "6.9.0",
"flow-bin": "0.37.0",
"jest": "18.1.0",
"react-test-renderer": "~15.4.0"
},
"jest": {
"preset": "react-native"
}
最佳答案
我认为这是由两个同名模块引起的错误。为我解决该问题的一种解决方法是告诉 Flow 忽略其中一个模块。换句话说,在 .flowconfig 文件的 [ignore]
部分下添加以下一行(或两行):
.*/node_modules/react-native/Libraries/Renderer/src/renderers/shared/shared/event/eventPlugins/TouchHistoryMath.js
.*/node_modules/react-native-gesture-responder/library/TouchHistoryMath.js
注意:第一个文件似乎是核心 React-Native 库的一部分,而第二个文件来自 @soutem/ui 使用的依赖项。我不确定从 Flow 中排除这些文件是否会产生任何副作用。
关于reactjs - 如何修复流量错误 "TouchHistoryMath. Duplicate module provider",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42262313/