はじめに
現在進行しているプロジェクトのタスクランナーでjavaがないとエラーになる事象が発生したので入れてみた。
事象
[12:16:44] gulp-notify: [Error running Gulp] ⚠️ Nu Html Checker (v.Nu) のエラーが出ています ⚠️
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
gulp-notifyでjavaを使ってるけど、macにjavaがないので怒られた。
javaのインストール
今回はbrewでjavaをインストールした。
java --version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
brew install java
インストールは完了。
バージョン確認しても、まだシンボリックをはってないのでエラーになる。
java --version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
シンボリックをはる。
sudo ln -sfn $(brew --prefix)/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
java --version
openjdk 21.0.1 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
無事にインストール完了!
タスクランナーのエラーも消えた。