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 ...
随机推荐
- eclipse debug 调试找不到资源问题解决
eclipse debug 的时候,如果使用maven bulid,就可能找不到class,这种情况就需要先停止服务,然后配置 Run configurations-Source,然后remove掉D ...
- python 删除特定字符所在行
#查询文件中含有特殊字符串的行 #!/usr/bin/python # -*- coding:utf- -*- import re file1 = open('test.txt','r+') istx ...
- linux在菜单中添加SEG选项
- SPOJ - AMR11B 判断是否在三角形 正方形 圆形内
Hogwarts is under attack by the Dark Lord, He-Who-Must-Not-Be-Named. To protect the students, Harry ...
- django国际化的简单设置
设置国际化的具体步骤: 一.国际化 1)效果:针对不同的国家的人可以配置不同的语言(一般是英文和中文, English Chinese) 2)目的:增加项目的用户量 3)难度:不难 比较费劲的就是 ...
- linux安装libreOffice
参考链接:https://qtdebug.com/mac-centos7-libreoffice/ https://blog.csdn.net/diyiday/article/details/7985 ...
- Mariadb多实例启动脚本
#!/bin/bash port=3306 mysql_user="root" mysql_pwd="centos" cmd_path="/app/m ...
- RHEL6 学习:使用 cryptsetup 给分区加密
RHEL6 学习:使用 cryptsetup 给分区加密 今天学习了 RHEL 对硬盘分区加密的知识,在 RHEL 系统里可以通过使用 cryptsetup 工具对硬盘分区进行加密,加密后的分区需要输 ...
- springboot2.0入门(三)----定义编程风格+jackjson使用+postMan测试
一.RESTFul风格API 1.优点: )看Url就知道要什么资源 )看http method就知道针对资源干什么 )看http status code就知道结果如何 HTTP方法体现对资源的操作: ...
- Luogu P4398 [JSOI2008]Blue Mary的战役地图 矩阵哈希
其实可以二分矩阵边长但是我太懒了$qwq$. 把每个子矩阵扔到$map$里,然后就没了 #include<cstdio> #include<map> #include<i ...