我在本地运行这个就好了,但是在设置我的Jenkins服务器做同样的事情之后我遇到了grunt无法找到grunt文件的问题。我可能错过了安装/配置的东西吗?我不知道错误输出有什么问题,这是我在jenkins盒子上得到的:
[user @ buildserver] #ls
AUTHORS CHANGELOG coverage Gruntfile.js package.json README.md reports spec src
[user @ buildserver] #grunt
grunt-cli: The grunt command line interface. (v0.1.6)
Fatal error: Unable to find local grunt.
If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:
http://gruntjs.com/getting-started
这是Gruntfile.js
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
jasmine : {
src : 'src/**/*.js',
options : {
specs : 'spec/**/*.js',
template : require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'reports/coverage.json',
report: 'reports/coverage'
}
}
},
});
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.registerTask('default', ['jasmine']);
};
答案 0 :(得分:18)
你在Jenkins服务器上安装了grunt吗?
npm install grunt
答案 1 :(得分:2)
你可以从jenkins管理界面设置一切,你不需要在本地安装grunt:)
希望你可以使用git / nodejs和grunt
有关如何将grunt / node任务添加到jenkins作业的更多详细信息,请参阅插件wiki - > https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin
这很容易:)
只有jenkins管理员权限才需要ssh登录