React Native 日常报错
在学习React.js 或 React Native 过程中,有时看着别人的框架或代码,但总是会出现错误,因为React或之中用到的一些包经常更新,有些代码或教程就显得过旧了。
一、日常报错 'config.h' file not found (每次RN新建一个工程都会出现)
a. xcode 10.0 file => Project setting => Build Systed => Legacy Build Systed
b. 再进行如下命令
cd node_modules/react-native/third-party/glog-0.3.
../../scripts/ios-configure-glog.sh
后来升级到xcode 10.1这个问题就没有了
二、Faied to load bundle
查看stackoverflow: 尝试解决或者看看这个issue: https://github.com/facebook/react-native/issues/18962
或者可以试试如下清除
.Clear watchman watches: 'watchman watch-del-all'
.Delete the node_modules: 'rm -rf node_modules && npm install'
.Reset Metro Bundler cache: 'rm -rf /tmp/metro-bundler-cache-*' or 'npm start -- --reset-cache'
.Remove haste cache: 'rm -rf /tmp/haste-map-react-native-packager-*'
最终我是如下解决的
2. mac电脑命令行 open ~
3. 将下载好的文件替换掉.rncache文件夹下的boost_1_63_0.tar.gz
4.在react native工程下执行npm install -g react-native-git-upgrade && react-native-git-upgrade
5.react-native run-ios (再不行就重启电脑执行这个命令)
6.结果发现上述情况有时成功,有时还是怎么都解决不了,于是将 xcode 的从10.0升级到了10.1,重新 react-native run-ios 便不再报错了。
三、import {Navigator} from 'react-native'报错: no such file or directory
react-native 0.44 版本以后 Navigator 需要从 react-native-deprecated-custom-components 导入。如果还报错如没有找到.jsbundle文件等,完全关闭一下模拟器,再重新 react-native run-ios
四、在React 16版本之后, PropTypes 从react包 换到了prop-types 包中,所以想要使用PropTypes 需要这样:
npm install prop-types --save
import PropTypes from 'prop-types'
五、Undefined is no an object (evaluating _reactNative.View.propTypes.style)
google到这个issue找到解决: https://github.com/facebook/react-native/issues/16542 (将 View.PropTypes.style 改成 ViewPropTypes.style )
如果还报错则需要一个引入: import {ViewPropTypes} from 'react-native', 参考这个链接下 husnaingoldev 的回答 https://github.com/facebook/react-native/issues/14032
React Native 日常报错的更多相关文章
- react native 环境报错
按照react native中文网的文档安装 1.brew 管理软件 2.node 在终端启动工程后就报下面这个错误 这个错误是在RN在第一次配置环境启动一个工程的时候 ,在这过程中下载的缓存文件不完 ...
- React Native 基础报错及解决方案记录
刚开始上手RN,碰到很多坑,记录一下.碰到问题多去看看github上面的issue! 启动命令react-native run-ios报错 1.:xcrun: error: unable to fin ...
- react native运行报错
更换RN项目目录位置后,react-native run-ios,出错. node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c 解决 ...
- react Native 运行报错之一 gradle-2.14.1-all解压失败的问题
在react-native run-android 时 可能出现压缩包不成功的情况,原因是压缩包失败,需要手动解压到相应目录, 目录:C:\Users\Administrator\.gradle\w ...
- Error处理: android.media.MediaRecorder.start(Native Method) 报错:start failed: -19【转】
本文转载自:http://blog.csdn.net/netwalk/article/details/17686993 Error处理: android.media.MediaRecorder.sta ...
- react native定报预披项目知识点总结
1.TextInput组件对安卓的适配问题 textInput 在iOS 显示正常,但是在android下会出现下横线,并且字会被遮盖 因此一般都这么用该组件 <TextInput style= ...
- react native 开发报错
1:oc对象名是RCTPoctalk 2:js中导入原生方法 3:报错:对象没有定义 出现这样的问题可能是react native 不允许使用“RCT”开头的前缀 4:解决办法:“RCT_EXPORT ...
- React Natived打包报错java.io.IOException: Could not delete path '...\android\support\v7'解决
问题详情 React Native打包apk时在第二次编译时候报错: java.io.IOException: Could not delete path 'D:\mycode\reactnative ...
- react 使用 ref 报错 ,[eslint] Using string literals in ref attributes is deprecated. (react/no-string-refs)
react 项目中给指定元素加事件,使用到 react 的 ref 属性,Eslink 报错 [eslint] Using string literals in ref attributes is d ...
随机推荐
- vue关于路由容易忽略的点
1.去掉导航里的# 在router.js中 export default new Router{ mode:'history' } 2.指定激活项的class 在router.js中 export d ...
- MAVEN打包时没有将src/main/cache文件夹打到到WAR包中
某项目中ehcache配置文件写在src/main/cache中,结果用maven打包时,得到的WAR包里面没有这个文件夹 因为maven打包时默认只打包src/main/java中的文件和src/m ...
- Web应用特性
什么是web应用? 软件开发架构 c/s架构 客户端 服务端 b/s架构 浏览器 服务器 本质:b/s架构其实也是c/s架构 HTTP协议 超文本传输协议:规定了客户端与服务端消息传输的格式 四大特性 ...
- 一周死磕fastreport ----ASP.NET (一)
https://blog.csdn.net/wuyuander/article/details/52692435 原文链接,点击跳转 首先是安装好FastReport .net: 然后在vs2012中 ...
- storm 的分组策略深入理解(-)
目录 storm的分组策略 根据实例来分析分组策略 common配置: Shuffle grouping shuffle grouping的实例代码 ShuffleGrouping 样例分析 Fiel ...
- eclipse新建jsp模版设置
第一步:找到JSP模板 eclipse -- >perferences - >Web -> jsp files -Editor ->templates: 第二步:准备编辑JSP ...
- Tenka1 Programmer Contest 2019 D - Three Colors
Three Colors 思路:dp 设sum为所有边的总和 不能组成三角形的情况:某条边长度>=ceil(sum/2),可以用dp求出这种情况的方案数,然后用总方案数减去就可以求出答案. 注意 ...
- 自定义ViewGroup基础巩固2---onMeasure()学习及综合实现圆形菜单
上次对自定义ViewGroup中的onLayout()方法进行了基础巩固[http://www.cnblogs.com/webor2006/p/7507284.html],对于熟知自定义ViewGro ...
- Spring入门篇——第6章 Spring AOP的API介绍
第6章 Spring AOP的API介绍 主要介绍Spring AOP中常用的API. 6-1 Spring AOP API的Pointcut.advice概念及应用 映射方法是sa开头的所有方法 如 ...
- Linux的正则练习
grep和 egrep的正则表达式 1.显示三个用户root.wang的UID和默认shell cat /etc/passwd | grep “^\(root\|wang\)” | tr ‘:’ ‘ ...