geowarin/boot-react

Error after run ./gradlew bootRun - Caused by: java.io.IOException: Cannot run program "yarn" (in directory "frontend")

andrespontt opened this issue · 3 comments

I'm trying to run the project on OSX Sierra 10.12.6

Installed jdk8, maven, gradle and yarn with homebrew

Yarn command is available to be used on my terminal but it is throwing the following exception

Caused by: java.io.IOException: Cannot run program "yarn" (in directory "frontend"): error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[na:1.8.0_144]

attached log after execute ./gradlew bootRun
bootRun.log.txt

Maybe I missed some step before. Please help.

same errors.

in my case not a "yarn" that is "cmd"

aused by: java.io.IOException: Cannot run program "cmd" (in directory "frontend"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[na:1.8.0_144]

the reason is
Fix frontend relative path to run Yarn #36

boot-react/backend/src/main/java/react/dev/YarnRunner.java

in the YarnRunner.java

private void yarnStart() throws IOException {
ProcessExecutor process = new ProcessExecutor()
.directory(new File("frontend"))
.command("yarn", "start")
.redirectOutput(Slf4jStream.of(LoggerFactory.getLogger("yarn")).asInfo())
.redirectError(Slf4jStream.of(LoggerFactory.getLogger("yarn")).asError());

if (isWindows()) {
  process = process.command("cmd", "/c", "yarn", "start");
}

process.start();

}

i changed like this
.directory(new File("frontend"))
=> .directory(new File("../frontend"))

and then, IOException is solved