【问题标题】:NPM does not update package properlyNPM 没有正确更新包
【发布时间】:2019-05-30 21:01:01
【问题描述】:

在我的 React Native (version 0.59.5) 应用程序中,我已经安装并链接了最新版本的 React Native Gesture Handler(version 1.2.2)。每当我在模拟器上运行应用程序时,我都会在成功构建后立即收到以下消息:

TypeError: param is not an Object. (evaluating "__isNative' in param')

This error is located at:
  inPanGestureHandler (at StackViewLayout.js:300)
  in StackViewLayout (at withOrientation.js:30)
  in withOrientation (at StackView.js:79)
  in RCTView (at View.js:45)
  in View (at Transitioner.js:215)
  in Transitioner (at StackView.js22)
  in StackView (created by Navigator)
  in Navigator (at createKeyboardAwareNavigator.js:12)
  in KeyboardAwareNavigator (created by SceneView)
  in SceneView (at createTabNavigator.js:39)
  in RCTView (at View.js:45)
  in View (at ResourceSavingScene.js:26)
  in ResourceSavingScene (at createBottomTabNavigator.js:113)
  in RCTView (at View.js:45)
  in View (at screens.native.js:83)
  in ScreenContainer (at createBottomTabNavigator.js:103)
  in RCTView (at View.js:45)
  in View (at createBottomTabNavigator.js:102)
  in TabNavigationView (at createTabNavigator.js:197)

但是,当我在不关闭或重新启动模拟器的情况下重新安装库时,请使用以下命令:

npm install --save react-native-gesture-handler@latest

在我重新加载(刷新应用程序)后,错误立即消失,我可以正确使用我的应用程序。

可能出了什么问题?为什么我总是必须重新安装库才能修复错误?

【问题讨论】:

  • 如果你只运行npm install --save react-native-gesture-handler 而不链接会发生什么?此外,最好在使用 React Native 安装新包之前关闭开发服务器。
  • 如果我不链接库,我会收到不同的错误。我总是在运行开发服务器之前安装新软件包,但是,在这种特定情况下,我需要在开发服务器运行时重新安装软件包,以消除错误并让应用程序正常工作。关于如何避免这种情况并解决一般错误的任何想法?

标签: javascript react-native npm


【解决方案1】:

通过从我的 Podfile 中删除以下子规范来解决。

【讨论】:

    猜你喜欢
    • 2021-04-20
    • 2012-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多