我正在配置一个新项目,并在收到以下流动错误时开始导入某些库。这个错误是什么意思,我如何诊断和修复?这是一个本机项目,我最近添加了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"
}
我相信这是由两个具有相同名称的模块引起的错误。解决这个问题的解决方法是告诉流程忽略其中一个模块。换句话说,在.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
注意:这些文件中的第一个似乎是核心反应库的一部分,而第二个文件来自 @shoutem/ui使用的依赖项。我不确定是否有任何副作用,将这些文件排除在流中。
您应该评论以下行。
# UNSUPPORTED - HASTE
#module.system=haste
#module.system.haste.use_name_reducers=true
参考:https://github.com/facebookarchive/node-haste
未支撑/存档的Facebook不再使用节点haste,这 项目没有维护。