Gulp不会在Jenkins工作 [英] Gulp won't work in Jenkins

查看:1768
本文介绍了Gulp不会在Jenkins工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装gulp全局(npm install gulp -g)。但这不工作我想。当我在我的本地程序gulp测试它工作正常。但是当我对我的(同一)程序从github(在Jenkins)做一个gulp测试,它给出以下错误。它不会识别gulp命令。
有人可以帮助我吗?感谢
Jenkins中的错误:

I've installed gulp globally (npm install gulp -g). But this isn't working I think. When I'm doing gulp test on my local program it works fine. But when I'm doing a gulp test on my (the same) program from github (on Jenkins), it gives the following error. It won't recognize the gulp command. Can someone help me? Thanks Error in Jenkins:

[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\project1
 > C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url https://github.com/Jelle7/project1.git # timeout=10
Fetching upstream changes from https://github.com/Jelle7/project1.git
 > C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
 > C:\Program Files (x86)\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://github.com/Jelle7/project1.git +refs/heads/*:refs/remotes/origin/*
 > C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision 6fe866ee6937a4862ac501c6ce185eda64067ed8 (refs/remotes/origin/master)
 > C:\Program Files (x86)\Git\bin\git.exe config core.sparsecheckout # timeout=10
 > C:\Program Files (x86)\Git\bin\git.exe checkout -f 6fe866ee6937a4862ac501c6ce185eda64067ed8
 > C:\Program Files (x86)\Git\bin\git.exe rev-list 6fe866ee6937a4862ac501c6ce185eda64067ed8 # timeout=10
[karma-test] $ cmd /c call C:\Windows\TEMP\hudson8554225917848574447.bat

C:\Program Files (x86)\Jenkins\workspace\project1>gulp test 
gulp is not recognized as an internal or external command

C:\Program Files (x86)\Jenkins\workspace\project1>exit 9009 
Build step 'Run Windows batch command.' marked build as failure
Finished: FAILURE

但在命令行中它运行良好。

But in commandline it worked well.

    C:\Program Files (x86)\Jenkins\workspace\project1>gulp test
[15:18:56] Using gulpfile C:\Program Files (x86)\Jenkins\workspace\project1\gulp
file.js
[15:18:56] Starting 'scripts'...
[15:18:57] all files 3.26 kB
[15:18:57] Finished 'scripts' after 387 ms
[15:18:57] Starting 'test'...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "C:/Program Files (x86)/Jenkins/workspace/project1/src/*
*/*.mock.js" does not match any file.
INFO [PhantomJS 1.9.8 (Windows 7)]: Connected on socket qZEPgByCA2MGyk1w_0TI wit
h id 43463083
PhantomJS 1.9.8 (Windows 7): Executed 1 of 1 SUCCESS (0.01 secs / 0.017 secs)
[15:18:59] Finished 'test' after 2.44 s


推荐答案

为了知道你的gulp是你应该定义gulp ENV全局(对于所有用户)或只是运行gulp.js通过节点每次:

For making know where your gulp is you should define gulp to ENV globally (for all users) or just run gulp.js via node every time:

node node_modules\gulp\bin\gulp.js test

记住,jenkins不知道任何关于你的用户变量,这是为了清楚的测试。唯一知道的ENV变量是全局变量。

Remember that jenkins doesn't know anything about your user variables, this is made for clear testing. The only ENV variables it knows are the global ones.

这篇关于Gulp不会在Jenkins工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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