2

I am trying to run ./gradlew in jhipster project and getting next error with ':bower' task:

:cleanResources
:bootBuildInfo
:bower FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bower'.
> A problem occurred starting process 'command 'bower''
.......

Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'bower'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
        ... 2 more
Caused by: java.io.IOException: Cannot run program "bower" (in directory "/Users/vovkvlad/coding/learning/Java/jHipProj"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 4 more

I have seen similar problems on stackoverflow:

  1. Running JHipster Gradle task from Intellij IDEA

  2. jhipster - error executing task :bower

But first link complains only about failure in IntelliJ (and in my case the same error occurs in the terminal)

And second link gives pretty strange answer with removing node which seems strange to me, and may be not applicable since 2 years have past.

So, do anyone have a key to what am I doing wrong? I will be grateful for any kind of help/hint. Thanks in advance for help!

EDIT: I have bower installed globally, so that it can be found under one of the paths in $PATH. And bower is recognized from the terminal.

Community
  • 1
  • 1
volk
  • 762
  • 1
  • 6
  • 19

2 Answers2

3

I was having this same issue. I was able to fix it by stopping the gradle daemon using ./gradlew --stop. Here is a link to a post where I found the solution.

Community
  • 1
  • 1
Kevin Gaasch
  • 131
  • 5
1

i got the same issue, and fixed it with command below.

gradle --stop

In my case, i use Eclipse with Buildship plugin, it starts a Grade Daemon to build project by itself, and the classpath of NodeJS & Bower is difference when running application in terminal.