ReactNative环境搭建遇到的问题

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:28   2705   0

1、安装 android studio问题:

安装了最新版发现很多问题,并没找到解决方案,建议:安装软件稳定版

2、执行react-native init xxx报错:

Error: Command failed: yarn add jest babel-jest babel-preset-react-native@^5 react-test-renderer@16.4.1 --dev --exact
at checkExecSyncError (child_process.js:601:13)
at execSync (child_process.js:641:13)
at generateProject (E:\myRepository\rn\AwesomeProject\node_modules\react-native\local-cli\init\init.js:105:7)
at Object.init (E:\myRepository\rn\AwesomeProject\node_modules\react-native\local-cli\init\init.js:53:5)
at run (C:\Users\llenovo\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
at createProject (C:\Users\llenovo\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\llenovo\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
at Object.<anonymous> (C:\Users\llenovo\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)

解决方案:降低版本(react-native init xxx --version 0.41.0(降低到0.44.0以下就OK了))

3、执行react-native run-android报错:

failed to find Build Tools revision 23.0.1

解决步骤:请查看

4、执行react-native run-android报错:

* Where:
Build file 'E:\myRepository\rn\AwesomeProject\android\build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'AwesomeProject'.
> Could not find method android() for arguments [build_cjmnst07ax2vupwy984hxg0cc$_run_closure2@4715ae33] on root project 'AwesomeProject'.

解决方案:注释掉Android()后就通过编译了。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP