reactjs - 如何修复流量错误 "TouchHistoryMath. Duplicate module provider"

标签 reactjs react-native

当我收到以下流程错误时,我正在配置一个新项目并开始导入一些库。此错误是什么意思以及如何诊断和修复?这是一个 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/

相关文章:

reactjs - 反冲 - 单原子与多个原子

google-play - react 原生谷歌支付和 Stripe 集成错误

javascript - React Query - useInfiniteQuery,如何在获取下一页时避免组件刷新

javascript - 如何使用蓝图在 React 中渲染表格

html - React App 在打开 react-signature-canvas 时有时会崩溃

reactjs - 为什么 React.FunctionComponenent 优于传统的函数定义?

javascript - 为 Formik 的 innerRef 获取 null

javascript - 主机名/IP 与证书的别名不匹配

react-native - 如何在React Native中设置 View 的背景颜色透明

android - 在 Android UI 组件中查看样式 Prop