React-Nativeエラー:JAVA_HOMEが設定されておらず、PATHに「java」コマンドが見つかりませんでした。
React Native Error Java_home Is Not Set
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation. error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details. This problem occurs when running react-native,
まず、インストールされているかどうかを確認しますjava jdk
そして、環境変数を構成します
環境変数を構成する
例としてwin10を取り上げます
デスクトップ>コンピュータ>右クリックプロパティ>システムの詳細設定>環境変数>システム変数
[新規]をクリックします
変数名:JAVA_HOME
パス:自分のインストールディレクトリによる
editpath変数
edit ==%JAVA_HOME% bin ==を追加します
コマンドウィンドウを再度開きます
プロジェクトファイルdirectoryreact-nativerun-androidの下で実行します