从TeamCity运行时找不到jshint

时间:2015-02-24 03:34:03

标签: teamcity jshint

我在计算机上安装了jshint:

npm install -g jshint

没有错误。从任何目录中的命令提示符输入:

jshint -v

所示:

jshint v2.6.0

我还安装了TeamCity 9.0.2,并且使用此命令行进行构建配置"构建步骤:

jshint -v

但构建失败,构建日志说:

[17:43:06]Step 1/7: Command Line
[17:43:06][Step 1/7] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script1904467346557960405.cmd
[17:43:06][Step 1/7] in directory: C:\TeamCity\buildAgent\work\494a4c7f8e6d54de
[17:43:06][Step 1/7] 'jshint' is not recognized as an internal or external command,
[17:43:06][Step 1/7] operable program or batch file.
[17:43:06][Step 1/7] Process exited with code 1
[17:43:06][Step 1/7] Step Command Line failed

如何从TeamCity运行jshint?

1 个答案:

答案 0 :(得分:0)

您必须在TeamCity中创建一个新的命令行构建步骤。请使用以下内容。

rm -rf $(pwd)/node_modules/*  #removing subfolders present in node_modules folder
rm -rf $(pwd)/bower_components/*  #removing subfolders present in bower_components folder 
npm cache clean
npm install  #auto detect and install all npm modules required for your project
npm install bower
npm install grunt-ftp-push --save-dev #if ftp push is required
bower install
grunt buildproduction

仅此构建步骤就足够了。我希望这会有效。