【问题标题】:"TypeError: undefined is not an object (evaluating '_react.PropTypes.array')" React native on Mac“TypeError: undefined is not an object (evalating '_react.PropTypes.array')” 在 Mac 上反应原生
【发布时间】:2021-08-15 18:16:57
【问题描述】:

我在 React Native 中遇到了问题。我的 React 原生项目完全在 windows 环境下工作。然后我在 Mac 系统中克隆了同一个项目并尝试运行这个项目,它抛出了一个错误。“TypeError: undefined is not an object (evaluation '_react.PropTypes.array')”。我的项目没有显示 PropTypes 的任何结果。我已经多次重启服务器。我尝试了不同的解决方案,但没有任何效果。请帮我解决这个问题

这是我的节点日志

 ERROR  TypeError: undefined is not an object (evaluating '_react.PropTypes.array')
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.  
 This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.   
 This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

【问题讨论】:

    标签: android ios macos react-native


    【解决方案1】:

    我解决了这个问题。花了很多时间来确定问题。在我的项目 "react-native-snap-carousel" 库中抛出此错误,在检测到问题后我关注this link

    npm install prop-types --save // install this
    import PropTypes from 'prop-types'; // add import in snap carousel file & remove PropTypes from 'react-native'
    

    【讨论】:

      猜你喜欢
      • 2020-08-15
      • 2020-01-26
      • 2019-01-20
      • 1970-01-01
      • 2016-07-30
      • 2020-08-31
      • 2020-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多