1. 程式人生 > >ReactNative環境搭建遇到的問題

ReactNative環境搭建遇到的問題

1、安裝 android studio問題:

安裝了最新版發現很多問題,並沒找到解決方案,建議:安裝軟體穩定版

2、執行react-native init xxx報錯:

Error: Command failed: yarn add jest babel-jest [email protected]^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 [

[email protected]] on root project 'AwesomeProject'.

解決方案:註釋掉Android()後就通過編譯了。