react-native 常见报错处理

1.java.io.IOException: Could not delete path 'F:\xxxx\android\app\build\intermediates\transforms\dex\debug\folders\1000'.

解决:(权限问题导致)以管理员身份运行控制台再运行react-native run-android,如果还报错手动删除'F:\xxxx\android\app'目录下的build文件夹。
2.FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-device-info:prepareComAndroidSupportAppcompatV72301Library'.
> Could not expand ZIP 'D:\SDK\extras\android\m2repository\com\android\support\appcompat-v7\23.0.1\appcompat-v7-23.0.1.aar'.
解决:此问题还1类似还是权限问题 ,手动删除“F:\xxxxx\node_modules\react-native-device-info\android”目录下的build文件夹。(注意:以上是以react-native-device-info组件为例,如果是其它组件报类似问题 目录为: \node_modules\组件名\android )
3.npm i 或npm install 界面卡死 ,如下:
[..................] - loadIdealTree:loadAllDepsIntoIdealTree: sill install loadIdealTree

解决:

方法一:源问题 ,npm换源参考:https://blog.csdn.net/wozaixiaoximen/article/details/50448893

方法二:如果还是不行考虑升级node 版本,或者降价node 版本 ,我的解决办法是:把node8.11.3降到node8.11.2

方法三:npm 命令换成 yarn 命令,yarn命令参考 https://blog.csdn.net/mjzhang1993/article/details/70092902

4.蚂蚁UI组件antd-mobile报错:

error: bundling failed: Error: Unable to resolve module `react-dom` from `F:\yewugorn\node_modules\antd-mobile\lib\modal\alert.js`: Module does not exist in the module map

解决:重新安装antd-mobile组件 yarn add antd-mobile 默认安装最高版本 ;

如果还没有好就安装指定版本实施yarn add [email protected]  安装指定版本。

扫描二维码关注公众号,回复: 4357661 查看本文章

如果安装过程卡住了或者安装失败请参考3换源 换命令再试试。

猜你喜欢

转载自blog.csdn.net/nfq6612/article/details/80973660