如何在jenkins上解决grunt无法识别的错误而Grunt在命令提示符下运行?

时间:2018-05-03 10:59:40

标签: jenkins grunt-cli

如何在jenkins上解决grunt无法识别的错误,而Grunt在命令提示符下运行?

詹金斯输出:

test cases will be executed
'grunt' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

3 个答案:

答案 0 :(得分:0)

最有可能的是,如果全局安装了grunt-cli包,则没有将可执行路径添加到系统的PATH变量中。

或者,如果您没有安装软件包,请在Windows shell中使用npm install -g grunt-cli

答案 1 :(得分:0)

问题与路径有关,基本上我的用户的路径变量有npm和grunt路径但系统路径变量中缺少。所以我添加了npm路径到系统路径变量,它适用于jenkins!

答案 2 :(得分:0)

对于我来说,路径定义正确。当我在CMD上执行它时,它起作用了,但Jenkins却没有。事实证明,这是由于Jenkins使用了自己的托管路径,如管理Jenkins->配置系统->全局属性中所定义。 在此处定义名为“ Path”的环境变量,然后将npm目录的位置添加到其中,例如:“ C:\ Users \您的用户名\ AppData \ Roaming \ npm;”