1
votes

I have a CI Build setup in VSTS. One of the tasks is a Grunt Task. When the task runs it fails with the following output:

2017-06-14T18:00:44.8952691Z ##[section]Starting: grunt build

2017-06-14T18:00:44.8952691Z ==============================================================================

2017-06-14T18:00:44.8952691Z Task : Grunt

2017-06-14T18:00:44.8952691Z Description : The JavaScript Task Runner

2017-06-14T18:00:44.8952691Z Version : 0.5.27

2017-06-14T18:00:44.8952691Z Author : Microsoft Corporation

2017-06-14T18:00:44.8952691Z Help : More Information

2017-06-14T18:00:44.8952691Z ==============================================================================

2017-06-14T18:00:45.2362520Z [command]C:\NPM\Modules\grunt.cmd build --gruntfile d:\a\1\s\Solution\Project\Gruntfile.js

2017-06-14T18:00:47.3905419Z grunt-cli: The grunt command line interface (v1.2.0)

2017-06-14T18:00:47.3905419Z

2017-06-14T18:00:47.3905419Z Fatal error: Unable to find local grunt.

2017-06-14T18:00:47.4895387Z 2017-06-14T18:00:47.4895387Z If you're seeing this message, grunt hasn't been installed locally to

2017-06-14T18:00:47.4895387Z your project. For more information about installing and configuring grunt,

2017-06-14T18:00:47.4895387Z please see the Getting Started guide:

2017-06-14T18:00:47.4895387Z

2017-06-14T18:00:47.4895387Z http://gruntjs.com/getting-started

2017-06-14T18:00:47.6415301Z ##[error]Grunt failed with error: C:\NPM\Modules\grunt.cmd failed with return code: 99

2017-06-14T18:00:47.6475300Z ##[section]Finishing: grunt build

The Build Definition has

Grunt Exists

in the demands.

I am using the "Hosted" Agent Queue. When I look at the "Hosted" Agent Capabilities it has:

grunt C:\NPM\Modules\grunt.cmd

listed.

Why is the build agent failing saying that it cannot find grunt?

1

1 Answers

1
votes

That is grunt-cli that can be execute grunt command, but you still need to install grunt package to the working folder (e.g. project folder)

Simple sample:

  1. Add npm task (working folder: $(build.sourcesdirectory); npm command: install; arguments:grunt)
  2. Add Grunt task (working folder: $(build.sourcesdirectory); Grunt File Path: [gruntfile.js file relative path of $(build.sourcesdirectory) )