Visual Studio 团队服务(托管代理)中的 Grunt 任务失败
Grunt Task Failing in Visual Studio Team Service (Hosted Agent)
我在 VSTS 中有一个 CI 构建设置。其中一项任务是 Grunt Task。任务运行时失败并显示以下输出:
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\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
构建定义有
Grunt Exists
在需求中。
我正在使用“托管”代理队列。当我查看“托管”代理功能时,它具有:
grunt C:\NPM\Modules\grunt.cmd
已上市。
为什么构建代理失败并提示找不到 grunt?
也就是grunt-cli可以执行grunt命令,但是你还需要安装grunt包到工作文件夹(例如项目文件夹)
简单示例:
- 添加 npm 任务(工作文件夹:
$(build.sourcesdirectory)
;npm 命令:install
;参数:grunt
)
- 添加 Grunt 任务(工作文件夹:
$(build.sourcesdirectory)
;Grunt 文件路径:[gruntfile.js file relative path of $(build.sourcesdirectory)
)
我在 VSTS 中有一个 CI 构建设置。其中一项任务是 Grunt Task。任务运行时失败并显示以下输出:
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\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
构建定义有
Grunt Exists
在需求中。
我正在使用“托管”代理队列。当我查看“托管”代理功能时,它具有:
grunt C:\NPM\Modules\grunt.cmd
已上市。
为什么构建代理失败并提示找不到 grunt?
也就是grunt-cli可以执行grunt命令,但是你还需要安装grunt包到工作文件夹(例如项目文件夹)
简单示例:
- 添加 npm 任务(工作文件夹:
$(build.sourcesdirectory)
;npm 命令:install
;参数:grunt
) - 添加 Grunt 任务(工作文件夹:
$(build.sourcesdirectory)
;Grunt 文件路径:[gruntfile.js file relative path of $(build.sourcesdirectory)
)