Jenkins脚本在Windows上使用npm install时过早退出 [英] Jenkins script quitting prematurely when using npm install on Windows

查看:591
本文介绍了Jenkins脚本在Windows上使用npm install时过早退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Jenkins工作中,我想使用Grunt构建一个JavaScript应用程序. Jenkins构建脚本会创建一个构建目录(如果尚不存在),更改到该目录并运行:

In my Jenkins job I want to build a JavaScript app using Grunt. The Jenkins build scripts creates a build directory (if it doesn't already exist), changes to that directory and runs:

npm install grunt
npm install grunt-zip
grunt --gruntfile=[something]

(当然,grunt-cli是全局安装的.)构建作业时,第一条语句会导致Grunt和依赖项按预期被拉低.但是,作业然后成功终止:

(Of course grunt-cli is installed globally.) When I build the job, the first statement causes Grunt and dependencies to be pulled down as expected. However, the job then terminates successfully:

Archiving artifacts
No emails were triggered.
Finished: SUCCESS

第二个npm install没有运行.知道为什么脚本在运行npm install之后而不是继续执行后续语句后会终止吗?

The second npm install is not run. Any idea why the script is terminating after running npm install instead of continuing to the subsequent statements?

推荐答案

因此,事实证明npm是批处理文件,而不是可执行文件,因此需要使用Jenkins脚本中的call调用它:

So it turns out that npm is a batch file, not an executable, so it needs to be invoked using call from the Jenkins script:

call npm install grunt

这篇关于Jenkins脚本在Windows上使用npm install时过早退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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