问题:Jenkins中的# 环境变量[重复]

我想在我的 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 node_modules\gulp\bin\gulp.js 测试吗?

解答

在 Windows 上名为“Property content”的“Inject environment variables into the build process”部分中,您应该添加如下内容:

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

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

NODE_PATH=%AppData%\npm\node_modules
Logo

CI/CD社区为您提供最前沿的新闻资讯和知识内容

更多推荐