TypeError:undefined不是函数(评估'addListener')

时间:2018-05-09 20:26:41

标签: javascript reactjs react-native

感觉有很多类似的问题,就像这个问题一样,但似乎没有一个问题适合我。这绝对不是代码相关的问题,一切都运行得很好,我运行了更新,现在我无法通过这个错误,有些软件包显然无法一起工作。

这是我的堆栈跟踪:

TypeError: undefined is not a function (evaluating 'addListener')

This error is located at:
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:71)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at Router.js:70)
    in App (at Router.js:91)
    in Router (at Router.js:10)
    in RouterComponent (at App.js:41)
    in Provider (at App.js:40)
    in App (at registerRootComponent.js:35)
    in RootErrorBoundary (at registerRootComponent.js:34)
    in ExpoRootComponent (at renderApplication.js:35)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)
- node_modules\react-native-router-flux\node_modules\react-navigation\src\getChildEventSubscriber.js:72:60 in <unknown>
- node_modules\react-native-router-flux\node_modules\react-navigation\src\getChildEventSubscriber.js:72:45 in getChildEventSubscri
ber
- ... 28 more stack frames from framework internals

以下是我当前的依赖项:

"dependencies": {
    "expo": "^25.0.1",
    "firebase": "^4.13.1",
    "lodash": "^4.17.10",
    "react": "16.2.0",
    "react-native": "^0.52.3",
    "react-native-router-flux": "^4.0.0-beta.30",
    "react-native-scripts": "^1.14.0",
    "react-navigation-redux-helpers": "^1.0.6",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.0",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.0",
    "jest-expo": "^25.1.0",
    "react-test-renderer": "16.2.0"
  },

希望有人遇到与我相同的依赖性问题!

非常感谢,

亚当

1 个答案:

答案 0 :(得分:0)

找到对我有用的东西:

rm -rf node_modules
yarn cache clean
yarn install

如此处的评论所示:https://github.com/aksonov/react-native-router-flux/issues/2799