我正在配置一个新项目,并在遇到以下流错误时开始导入一些库。这个错误意味着什么,我该如何诊断和修复?这是一个反应原生项目,我最近添加了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"
}
答案 0 :(得分:1)
我认为这是由两个具有相同名称的模块引起的错误。解决这个问题的解决方法是告诉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库的一部分,而第二个文件来自@ shoutem / ui使用的依赖项。我不确定从Flow中排除任何这些文件是否有任何副作用。
答案 1 :(得分:0)
您应该注释这些行。
# UNSUPPORTED - HASTE
#module.system=haste
#module.system.haste.use_name_reducers=true
参考:https://github.com/facebookarchive/node-haste
不受支持/已存档的Facebook不再使用节点急速,这 项目没有得到维护。