【问题标题】:Environment variable in Jenkins [duplicate]Jenkins中的环境变量[重复]
【发布时间】:2015-04-09 02:45:40
【问题描述】:

我想在我的 Windows7 上在 Jenkins 中运行 gulp 测试。当我在我的 cmd 中运行它时,测试成功。所以我使用命令:

gulp test

但是当我在 Jenkins 的 windows 批处理命令中添加 gulp 测试时,无法识别 gulp 命令。我试图为它创建一个环境变量。但它仍然失败。我有一个带有此输入的 prop.properties 文件。

gulp=node node_modules\gulp\bin\gulp.js

比我使用的:在构建过程中注入环境变量。我在我的 Jenkins 中定义了属性文件路径。当我构建作业时,我收到以下消息:

[EnvInject] - Injecting as environment variables the properties file path 'C:/path/propfile.properties'
[EnvInject] - Variables injected successfully.

但我在 Jenkins 中的 Windows 批处理命令无法识别该变量。

gulp is not recognized as internal or external command

谁能给我解释一个方法,这样我就可以在我的 Windows 一批 Jenkins 中使用 gulp test 命令,而不是 node_modules\gulp\bin\gulp.js 测试?

【问题讨论】:

标签: jenkins environment-variables gulp


【解决方案1】:

在 Windows 上名为“属性内容”的“将环境变量注入构建过程”部分中,您应该添加如下内容:

PATH=$WORKSPACE\node_modules\gulp\bin\;$PATH

还有一件事是将 gulp.js 作为节点应用程序运行,您应该将 NODE_PATH 添加到路径

NODE_PATH=%AppData%\npm\node_modules

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-06
    • 2017-08-09
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 2018-12-27
    • 1970-01-01
    相关资源
    最近更新 更多