Reputation: 295
I'm trying to run grunt in jenkins (ubuntu), I already install nodejs plugin, then restarted jenkins. I create my job and inside of it I ticked under Build Environment the Provide Node & npm bin/ folder to PATH
Then in the Execute shell I run npm --version
in sell my output is + npm --version 1.4.9
, but if I run grunt --version
, my output is grunt: not found
.
I also tried in windows, in this case, I didn't install the nodejs plugin, I install everything from the bash command line. In this case I have this out put from jenkins for node and npm:
C:\Program Files (x86)\Jenkins\jobs\test-jenkins\workspace>node --version
v0.10.29
C:\Program Files (x86)\Jenkins\jobs\test-jenkins\workspace>npm --version
1.4.14
and again for grunt:
C:\Program Files (x86)\Jenkins\jobs\test-jenkins\workspace>grunt
'grunt' is not recognize as a command or a bash file
Upvotes: 1
Views: 3237
Reputation: 1145
The above problem comes up not only in linux but also in windows and here's a very simple solution which will work in most cases if you know where your grunt is installed. No need of installing any plugins.
As far as jenkins build is concerned it installs in drive:/.jenkins....../workspace/node_modules/.bin
.
After providing this path in jenkins using shell script export path=$PATH:drive:/.jenkins....../workspace/node_modules/.bin
, grunt started executing.
You can also check where the executable's are available on system path/ from where jenkins executes your executable's. Use which "executable_name"
without qoutes. you can use this command both on windows as well as linux.
For complete reference: grunt-not-recognized-jenkins
Upvotes: 0
Reputation: 295
I manage to put this working only in Ubuntu.
I added the plugin nodejs to jenkins (jenkins -> manage plugins)
and then restarted jenkins.
After I went to my job, I checked the Provide Node & npm bin/ folder to PATH
.Then I installed all the packages that I needed from the shell
.
After that grunt
worked fine.
Upvotes: 1