首页 > 解决方案 > “TypeError: undefined is not an object (evalating '_react.PropTypes.array')” 在 Mac 上反应原生

问题描述

我在本机反应中遇到了问题。我的 React 原生项目完全在 windows 环境下工作。然后我在 Mac 系统中克隆了这个相同的项目并尝试运行这个项目,它抛出了一个错误。“TypeError: undefined is not an object (evalating '_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.

标签: androidiosmacosreact-native

解决方案


我解决了这个问题。花了很多时间来确定问题。在我的项目“react-native-snap-carousel”库中抛出这个错误,在检测到问题后我点击了这个链接

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

推荐阅读