1 react-native 在新版Xcode(10+)中运行出现的问题:
node_modules/react-native/third-party/glog-0.3.5 , C compiler cannot create executables
third-party: 'config.h' file not found 解决方案
错误截图
错误截图这个是常见错误,只需要在项目根目录下运行以下命令即可解决:
cd node_modules/react-native/third-party/glog-0.3.5
../../scripts/ios-configure-glog.sh
参考github 问题地址 https://github.com/facebook/react-native/issues/19774
2 react-native 在新版Xcode(10+)中运行出现的问题:bundling failed: Error: Unable to resolve module /../react-transform-hmr/lib/index.js
错误截图用 react-native start --reset-cache命令解决了
参考github 问题地址:https://github.com/facebook/react-native/issues/21530
参考 https://segmentfault.com/a/1190000016601700
3 When starting a new project with react-native init then run iOS, I'm getting the error :
Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map
错误截图 解决方案截图for now after react-native init, since a lot of new changes are coming out, this fix worked for me (I got it from reading other issues):
with npm:
npm install --save-dev @babel/core
npm install --save-dev @babel/runtime
npm run start --reset-cache
or
react-native start --reset-cache
参考:https://github.com/facebook/react-native/issues/21310
4 typeerror cannot convert undefined or null to object
错误截图调试看日志,一般情况就是网络返回数据字典无法转成对象,
我在定义了一个对象RowData,而网络请求返回的是字典需要将字典转换成对象就可以了。
cell里面定义是对象 请求数据截图需要将网络请求返回的数据转为成对象就ok了。
5 Module AppRegistry is not registered callable module (calling runApplication)
错误截图
解决方案
Just kill all node process and start npm server and run application:
Step1: run command killall -9 node
Step2: run command npm start
Step3: run command react-native run-ios OR react-native run-android
6 用第3方库react-native-scrollable-tab-view报的错误
错误截图解决方案删掉第9行props后面的逗号就行了或者运行作者fix bug的代码也可以
解决方案截图 解决方案截图npm i -s https://github.com/happypancake/react-native-scrollable-tab-view.git to get fix code from master
7 用第3方库react-native-viewpager报的错误
undefined is note an object(evaluating 'React.propTypes.func')
错误截图 解决方案截图8 Module not found:Can't resolve '@babel/runtime/helpers/builtin/** in '...'
错误提示截图 解决方案截图参考:https://zj-john.github.io/tips/cjkwcx8ex009jakf0pd95ekzv.html
9 eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0"
错误提示截图 解决方案截图上面的翻译如下:
1 在终端执行npm install npm@latest -g
2 然后去js官网下载最新的版本安装
https://nodejs.org/zh-cn/
下载最新的js版本并安装3 然后在执行在指定文件夹,打开terminal终端用命令create-react-app todomyapp就不报错误了。
网友评论