run Grunt.js with Jenkins
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
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/bingrunt
I hope this helps you as well :-)
you can allow setup everything from jenkins :
Install Jenkins Plugins
- Git Plugin - for git
- Git Client Plugin - for git
- Git Parameter Plugin - for git tags
- GitHub API Plugin - for github
- NodeJS Plugin - integration for common javascript tools NodeJS & npm
Git / Ant / Maven / NodeJS Installations
- Goto SERVER/jenkins/configure
- Git -> Git installations -> Add Git -> JGit
- Git plugin -> Global Config user.name Value = "Anthony Mckale", Global Config user.email Value = "anthony.mckale@bskyb.com"
- NodeJS- > NodeJS installations -> Add NodeJS -> Name = "NodeJS 0.11.10", tick "Install automatically", select "Install from nodejs.org", add "grunt-cli" to globally installed packages
TADA
and hopefully git/nodejs and grunt will be available to you