Grunt与windows上的Jenkins集成问题 [英] Grunt integration with Jenkins on windows issue

查看:254
本文介绍了Grunt与windows上的Jenkins集成问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Tomcat7上运行Jenkins - Windows 7.我在jenkins配置中提供了节点bin路径。然后运行一个shell脚本如下:

  echo $ PATH 
node --version
npm install - g grunt-cli
npm install
grunt cssmin

正如其他文章 Jenkins与Grunt集成,我已经重新启动了我的jenkins几次,并试图在所有

来自jenkins控制台输出的错误堆栈跟踪:

  /c/apache-maven-3.2.5/bin:/c/Program Files / Java / jdk1.7.0_79 / bin:/ c / Program Files / nodejs / bin:/ c / Program Files / Java / jdk1.7.0_79 / bin:/ c / Program Files / nodejs /:

+ node --version
v0.10.30
+ npm install -g grunt-cli
C:\Windows\system32\config\systemprofile\AppData\Roaming\\\
pm\grunt-> C:\ Windows \ system32 \config\systemprofile\AppData\Roaming\\\
pm\\\
ode_modules\grunt-cli\bin\grunt
grunt-cli@0.1.13 C: \Windows\system32\config\systemprofile\AppData\Roaming\\\
pm\\\
ode_modules\grunt-cli
“‬resolve@0.3.1
“Nopt@1.0.10(abbrev@1.0.7)
â€â€findup-sync@0.1.3(lodash@2.4.2,glob@3.2 .11)
+ npm install
npm WARN package.json Trademust@1.0.0无仓库字段。
+ grunt cssmin
C:\程序文件\ Apache Software Foundation\Tomcat 7.0\temp\hudson2968878175697925824.sh:第6行:grunt:command not found
构建步骤'执行shell'标记为失败
完成:FAILURE

我也按照上述步骤在这个网站 grunt-on-jenkins



package.json和Gruntfile.js在我第一次执行jenkins build时位于根目录中,grunt从我的gruntfile.js中安装了所有模块,之后在所有其他build中它显示以上输出。



任何人都可以在这里查看发生了什么问题。

解决方案

搜索了很多之后,我发现我的咕噜声安装在哪里。就jenkins构建而言,它安装在驱动器中:/。jenkins ...... / workspace / node_modules / .bin



在jenkins中使用shell脚本 export path = $ PATH:drive:/。jenkins ...... / workspace / node_modules / .bin $ b

我在这个过程中学到的是检查系统路径中可执行文件的可用位置,或者jenkins引用的路径是使用哪个executable_name没有qoutes。你可以在windows和linux上使用这个命令。例如:哪个grunt 会显示grunt可执行文件存在的路径。


I am running Jenkins on Tomcat7 - Windows 7. I have provided the node bin path in my jenkins configuration. Then running a shell script as follows:

echo $PATH
node --version
npm install -g grunt-cli
npm install
grunt cssmin

As suggested in other post Jenkins integration with Grunt, I have restarted my jenkins several times, and tried to work on all the answers written in that post, but still it shows error, grunt: command not found.

Error stack trace from jenkins console output:

/c/apache-maven-3.2.5/bin:/c/Program Files/Java/jdk1.7.0_79/bin:/c/Program Files/nodejs/bin:/c/Program Files/Java/jdk1.7.0_79/bin:/c/Program Files/nodejs/:

+ node --version
v0.10.30
+ npm install -g grunt-cli
C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\grunt -> C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
grunt-cli@0.1.13 C:\Windows\system32\config\systemprofile\AppData\Roaming\npm\node_modules\grunt-cli
â"œâ"€â"€ resolve@0.3.1
â"œâ"€â"€ nopt@1.0.10 (abbrev@1.0.7)
â""â"€â"€ findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11)
+ npm install
npm WARN package.json Trademust@1.0.0 No repository field.
+ grunt cssmin
C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp\hudson2968878175697925824.sh: line 6: grunt: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

I have also followed the steps mentioned on this site grunt-on-jenkins

package.json and Gruntfile.js are in root directory the very first time when I executed the jenkins build, grunt installed all modules from my gruntfile.js, and after that in all other build's its showing the above output.

Can anyone please check what's going on wrong here.

解决方案

After searching a lot, I found where my grunt is installed. 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.

Also what I learnt in this process was checking where the executable's are available on system path or which path jenkins refers to is using which "executable_name" without qoutes. you can use this command both on windows as well as linux. Ex: which grunt will show the path where grunt executable file is present.

这篇关于Grunt与windows上的Jenkins集成问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆