I have MacOS with IntelliJ Idea installed. I\'m using Gradle (gradle-2.4) for building the project. I have NodeJS and NPM installed on the Mac and available from the shell.
Might be usefull for someone:
In my case the problem was, that I had Android Studio running. Had to quit it first, then everything worked fine again.
Might be helpfull:
sudo launchctl config user path $PATH
"To take effect might have to restart your machine"
The answer is this is trivial it turns out. Solution is applicable to ANY application.
The reason for the error is that none of the visual apps on Mac OS X use a user shell so whatever you have in your local profile settings such as ~/.bash_profile
simply does not take when Studio is launched. There is a good workaround:
cd /Applications/Android Studio.app/Contents/MacOS
studio_app
(or whatever is your executable name)mv $executable$ $executable$_app
$executable$
, and populate it like this. Here I am using my bash_profile
.#!/bin/sh
. ~/.bash_profile
logger "`dirname \"$0\"`/$executable$_app"
exec "`dirname \"$0\"`/$executable$_app" $@
chmod +x $executable$
And that is it. Relaunch Studio app normally and now it has inherited all your settings from bash_profile
, including path to node etc.
Substitute $executable$
with the name of your exe file. For Android Studio it would be just studio. For IntelliJ it should be just intellij (double check).
I had the same problem and got it resolved by running the command:
gradle --stop
I stop the gradle daemon by running
$ ./gradlew --stop
rerun the gradle command and fix it.
I ran into this same issue attempting to run Gradle tasks that executed commands such as node and npm from the Gradle plugin in Intellij. You can see from the stack trace that the Gradle plugin is attempting to execute external system commands and it is getting errors such as this:
WARN - nal.AbstractExternalSystemTask - error=2, No such file or directory
com.intellij.openapi.externalSystem.model.ExternalSystemException: error=2, No such file or directory
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:228)
You can reproduce this error from the command line if you remove the executables (ie node, npm) from the path, which tells me that something about the plugin is not honoring the environment path.
My Gradle plugin is using the projects gradlew (gradle wrapper version 2.3), so I attempted to point the plugin at a more recent Gradle installation on my system (version 2.10) and it worked.
I then resolved my issue by regenerating the gradle wrapper for my project and then setting the IntelliJ Gradle plugin to point back to my wrapper.
I have no idea what the original problem was.