Gradle “… occurred starting process 'command 'npm''” on Mac

前端 未结 7 1900

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.

7条回答
  •  滥情空心
    2021-02-06 22:43

    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.

提交回复
热议问题