Reputation: 417
I've set up a Gruntfile with mocha testing and JSlint. This works fine if i just run grunt form the terminal.
I want to run grunt from Jenkins!
I set up a new job -> and made built to a shell script and included:
/usr/local/bin/grunt
Once I run the job the terminal output of Jenkins says:
[workspace] $ /bin/sh -xe /tmp/hudson8550584576040162032.sh
+ /usr/local/bin/grunt
/usr/bin/env: node: No such file or directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
it seems it cant fine node binary!?! but node is installed and runs fine in the terminal!
All my binaries (mocha, grunt, node) are in /usr/local/bin/
Does anyone know what the issue is? Or maybe someone has a link to set up grunt.js with jenkins?
Somebody got something?
Thx
Upvotes: 16
Views: 11825
Reputation: 3034
you can allow setup everything from jenkins :
and hopefully git/nodejs and grunt will be available to you
Upvotes: 0
Reputation: 15078
This is happening because Jenkins will be running as a different user which probably doesn't have /usr/local/bin
in its $PATH
.
In your shell script make sure /usr/local/bin
is being added to your $PATH
export PATH="/usr/local/bin:$PATH"
# This will also mean you can call 'grunt' rather than '/usr/local/bin/grunt'
grunt
This has the added benefit of calling any programs you've installed in /usr/local/bin
over anything in /usr/bin
. If you don't want this behavior, simply append instead of prepend:
export PATH="$PATH:/usr/local/bin"
# This will also mean you can call 'grunt' rather than '/usr/local/bin/grunt'
grunt
Upvotes: 19
Reputation: 5905
To be honest I'm not familiar with Jenkins but I had same issue when I wanted to integrate GruntJS with XCode custom build step or within TeamCity deployment process.
I fixed my problem by adding /usr/local/bin/ to the PATH within my shell script before running grunt or node. Something like:
PATH=${PATH}:/usr/local/bin
grunt
I hope this helps you as well :-)
Upvotes: 1