0

I am just starting to play with the JHipster framework / code generator using intellij 14.1.5 on OSX Yosemite. I have a simple app with a couple of domain objects which I have imported into Intellij as a gradle project. When I attempt to run the app via the gradle build "run" task, the build fails on the bower command. I can successfully run this gradle task from the osx terminal app AND from withing Intellij's terminal window. It fails when I invoke the run task from the from the gradle tasks pane or if I run it from the "run configurations" drop down in the toolbar. It feels like it fails when Intellij invokes gradle, but succeeds when gradlew is invoked in a terminal. I'm not sure why there would be a difference in these environments / invocations.

I have installed npm/gulp/bower/yoeman via nvm/node and am up on current versions (installed today). Node is at 4.1.1.

Bill Pfeiffer
  • 926
  • 8
  • 20
  • How does it fail? Please provide logs. The difference could be that IDEA may call gradle as a global command rather than the local gradlew wrapper. – Gaël Marziou Sep 28 '15 at 10:15
  • Here is the output: 8:58:05 AM: Executing external task 'run'... :generateMainMapperClasses :compileJava :compileScala UP-TO-DATE :bower FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':bower'. > A problem occurred starting process 'command 'bower'' * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 7.481 secs error=2, No such file or directory 8:58:14 AM: External task execution finished 'run'. – Bill Pfeiffer Sep 29 '15 at 12:58
  • So it says that bower command could not be found, either you did not install it using 'npm install -g bower' or it's not in your path. Check the docs. – Gaël Marziou Sep 29 '15 at 17:05
  • Must not have been explicitly clear from my original post, but the fact that the same gradle task runs fine from both Idea terminal pane and the OSX terminal indicates that bower has indeed been globally installed properly. Also bower runs fine from any terminal in several web only projects that I work with. This really feels like an Idea+Gradle environment or config issue. – Bill Pfeiffer Sep 30 '15 at 00:40
  • Hi, did you where able too resolve your issue ? I'm having the same problem. I can run any gradle tasks in any terminal (idea, unix terminal etc.), but when if I run gradle task it fails with: - Could not start 'npm' - Cannot run program "npm" I see that there is no npm folder in /usr/bin/. But I have in in my location: /home/mmalik/.nvm/versions/node/v0.12.14/bin/npm – Sniady Jun 09 '16 at 11:39
  • I have solved this by following the response here: http://stackoverflow.com/a/30023108/268101 Be aware that you have account for the paths to your version of intellij. – Bill Pfeiffer Jun 11 '16 at 08:11
  • i did the same question. solved here: http://stackoverflow.com/a/30023108/268101 – eduardoschmidtsantos Sep 06 '16 at 16:52

2 Answers2

0

Posting this answer because no one has posted one yet. I have followed the recommendation of this other post. It fixes the Intellij app launcher on the mac to recognize the path for node commands. The original technique is described in apple.stackexchange.com. I am using this technique with the latest Intellij Idea 2016.1.3 and Intellij invoked gradle runs bower / npm just fine.

Community
  • 1
  • 1
Bill Pfeiffer
  • 926
  • 8
  • 20
  • I just installed Intellij 2016.2 and it overwrote my info.plist and removed the idea.sh. Had to redo the steps outlined in the original post that I refer to above. This process still works. I will open a ticket Jetbrains to see if they can add this to their MacOS installer. – Bill Pfeiffer Jul 13 '16 at 10:53
  • There was a [ticket](https://youtrack.jetbrains.com/issue/IDEA-127993) for the issue already. Its been out there for 2 years at this point. – Bill Pfeiffer Jul 13 '16 at 11:15
  • So the Eclipse [Mars BuildShip gradle plugin](https://projects.eclipse.org/projects/tools.buildship) exhibits the same behavior and the solution pointed at in my answer work for that as well. Just change out the Intellij app and associated artifacts with their eclipse counterparts. – Bill Pfeiffer Aug 13 '16 at 15:16
0

Just update gradle version.

Open gradle/wrapper/gradle-wrapper.properties and change version like distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip