eclipse mac os: Build-Explorer java.io.IOException: error=2, No such file or directory
I am using the "jsbuild-eclipse-plugin (v 0.10)" in Juno SR2 on Mac OS Yosemite. Running a task (gulp or grunt) by Build-Explorer does not work, the following error occurs:
java.io.IOException: Cannot run program "gulp" (in directory "/Users/test/workspace/myProj"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:871)
at fr.opensagres.eclipse.jsbuild.core.launchConfigurationTypes.JSBuildFileLaunchConfigurationDelegate.launch(JSBuildFileLaunchConfigurationDelegate.java:80)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.
It shows "No such file or directory", but there is indeed a gulp.file within this directory.
Besides, if I open eclipse by bash with "./eclipse", then running a task by "Build-Explorer" will work and no error occurs. Hower, normally a user does not open eclipse by terminal. Would be nice to fix this issue.
Have you tried to install with npm grunt-cli in your Eclipse project?
I have not Mac OS, so it's hard for me to fix this issue. I have windows and I had to call grunt.cmd instead of calling grunt. Perhaps it's the same problem with Mac OS.
Could you test if your terminal the call of grunt.cmd (instead of calling grunt) works?
I am using a gulp-file, not grunt. I only clicked a gulp-target in the build-explorer and the stacktrace above is shown. If using terminal with "grunt taskname', then all works as expected. However, I want to use the Build-Explorer in Eclipse, not the terminal.
Yes I have understood your problem. When you use Build-Explorer it execute a process with the command "grunt taskname". But for windows it didn't worked. The command that It generates is "grunt.cmd taskname" and not "grunt taskname" otherwise it didn't work, although if I open a DOS command I can use "grunt taskname"?
So for Mac OS, it's perhaps the same problem. Which command must be generated?
The odd thing is, if I open eclipse by terminal (./eclipse) instead of clicking its icon, then the build-explorer works as expected. Try opening eclipse in DOS, then build-explorer will work. However, normal users open eclipse by clicking its icon. Maybe it's a issue with permissions or shell-commands (such as -i). I dont know.
Have you try to install gulp in your eclipse project to have "/Users/test/workspace/myProj/node_modules/.bin/gulp" file and "/Users/test/workspace/myProj/gulp" folder?
Yes, I have installed gulp and npm via cli within my project before. But it does not make a difference. As I said, running gulp tasks by terminal works. Running tasks by build-explorer only works, if I opened eclipse by terminal (./eclipse). In other cases, running tasks by build-explorer does not work.
I'm sorry @nimo23, I don't know how to fix your problem since I have not Mac.
Any contribution are welcome!
@nimo23 could you tell me if with mac, the launch with shell "gulp.cmd" is working?
@angelozerr with mac, gulp cmd on terminal works, but build-explorer does not work.
The other thing is when having gulp-tasks within subdirectories. Build-Explorer does not recognices these tasks. For example, having gulpfile.js in root-dir with this content:
// all gulp tasks are located in the ./build/tasks directory
// gulp configuration is in files in ./build directory
require('require-dir')('build/tasks');
@nimo23 thanks for the info. I will do a big refactoring to execute grunt/gulp with node command (and not with grunt command) like I'm doing for protractor https://github.com/angelozerr/angularjs-eclipse/wiki/Protractor
The benefit to do that is that we will able to debug gulp file.
The other thing is when having gulp-tasks within subdirectories. Build-Explorer does not recognices these tasks.
Could you create an issue with that (I'm afraid that it's not a simple work -()
Ok, thanks.
https://github.com/angelozerr/jsbuild-eclipse/issues/11