ReactNative环境搭建遇到的问题

1、安装 android studio问题:

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

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

Error: Command failed: yarn add jest babel-jest babel-preset-react-native@^5 [email protected] --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()后就通过编译了。

猜你喜欢

转载自blog.csdn.net/youngeffort/article/details/82144982