在Jenkins中使用Node.js作为环境变量

时间:2021-07-30 23:23:18

I am attempting to run Protractor End-To-End tests in Jenkins. The tests are being run on a windows slave that has Node.js installed on it. For reasons that are unknown to me I cannot get the Node.js plugin on Jenkins so I have been trying to find another way around it.

我试图在Jenkins中运行Protractor End-To-End测试。测试正在一个安装了Node.js的Windows slave上运行。由于我不知道的原因,我无法在Jenkins上获得Node.js插件,所以我一直试图找到另一种方法。

Thats where "Prepare an environment to run" from EnvInject comes in. EnvInject is already added to our Jenkins.

这是来自EnvInject的“准备运行环境”的地方.EnvInject已添加到我们的Jenkins中。

I am unsure on how to use it however currently I have the following

我不确定如何使用它,但目前我有以下内容

Path = C:\Program Files\nodejs\node.exe;C:\Program Files\nodejs\npm

Path = C:\ Program Files \ nodejs \ node.exe; C:\ Program Files \ nodejs \ npm

In the properties content section. If this is correct how do I use this to then do npm install so that I can get files that I need for setting up the selenium server

在属性内容部分。如果这是正确的,我如何使用它来执行npm install,以便我可以获取设置selenium服务器所需的文件

1 个解决方案

#1


0  

You should set your path to contain the directories containing the nodes and npm executables, not the executables themselves. Also, it's been a long time since I used Windows, but I think PATH should be upper case. So you need:

您应该设置路径以包含包含节点和npm可执行文件的目录,而不是可执行文件本身。此外,自从我使用Windows以来已经很长时间了,但我认为PATH应该是大写的。所以你需要:

PATH=C:\Program Files\nodejs;C:\Program Files\nodejs

Then if you run "npm install" for example, Windows will search the PATH for directories containing npm.exe.

然后,如果您运行“npm install”,Windows将在PATH中搜索包含npm.exe的目录。

#1


0  

You should set your path to contain the directories containing the nodes and npm executables, not the executables themselves. Also, it's been a long time since I used Windows, but I think PATH should be upper case. So you need:

您应该设置路径以包含包含节点和npm可执行文件的目录,而不是可执行文件本身。此外,自从我使用Windows以来已经很长时间了,但我认为PATH应该是大写的。所以你需要:

PATH=C:\Program Files\nodejs;C:\Program Files\nodejs

Then if you run "npm install" for example, Windows will search the PATH for directories containing npm.exe.

然后,如果您运行“npm install”,Windows将在PATH中搜索包含npm.exe的目录。