如何从詹金斯运行 npm/grunt 命令 [英] how to run npm/grunt command from jenkins

查看:30
本文介绍了如何从詹金斯运行 npm/grunt 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个领域的新手,并试图从 jenkins 运行以下命令:

I'm new to this area and was trying to run the following commands from jenkins:

npm install
grunt quickStart

到目前为止,我已经在窗口机器上运行了一个 jenkins 作为窗口服务,并且我还为 jenkins 安装了 NodeJs 插件.

So far I've a jenkins running on a window machine as a window service and I've also installed NodeJs plugin for jenkins.

但是,按照此处,它要求我添加一个或模式 nodeJs 安装,但我找不到这些设置,甚至不确定我是否一开始就需要它们.

However, I'm stuck and quit confused following instructions here, its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place.

这是要求我做的一点:

我无法看到我创建的 jenkins 作业的此设置.有没有一种简单的方法可以从 .bat.sh 脚本在 jenkins 中运行这些命令,因为我会推荐 .batm 在窗口机器上.

I cannot see this setting for the jenkins job I create. Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine.

注意:我已经在 jenkins 中使用 git 签出了一个项目!!!

Note : I've already checked out a project using git in jenkins!!!

谢谢

推荐答案

"它要求我添加一个或模式 nodeJs 安装,但我找不到这些设置,甚至不确定我是否需要它们第一名."
我认为您不需要我将 jenkins 指向节点安装文件夹,仅此而已..,为此您转到管理 Jenkins-> 配置系统->NodeJS->NodeJS 安装.. 输入您喜欢的任何名称并指向节点主文件夹所在的位置.

"its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place."
I don't think you need that I have pointed jenkins to the node installation folder an nothing more.., for this you go to Manage Jenkins->Configure System->NodeJS->NodeJS installations.. type in any name you like and point to where the node home folder is.

...无法看到我创建的 jenkins 作业的此设置...

一旦您在 jenkins 配置中进行了配置,您应该可以像这样使用该配置:

Once you have configure that in your jenkins configuration you should have that configuration available like so:

...是否有一种简单的方法可以从 .bat 或 .sh 脚本在 jenkins 中运行这些命令,建议使用 .bat,因为我使用的是窗口机器
抱歉没明白你指的是什么命令...总结一下:

...Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine
I'm sorry don't get what commands are you referring to... so summarizing :

  1. 你必须告诉 jenkins 你的节点安装在哪里
  2. 在您的作业中使用该配置

希望这有帮助...

这篇关于如何从詹金斯运行 npm/grunt 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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