Gruntjs Grunt Concat无法写入文件

Gruntjs Grunt Concat无法写入文件,gruntjs,Gruntjs,刚刚在Ubuntu 12.04上安装了最新的Grunt。这是我的Grunfile文件: module.exports = function(grunt){ //project configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { slides : { src : ['src/top.html', 'src/bottom.h

刚刚在Ubuntu 12.04上安装了最新的Grunt。这是我的Grunfile文件:

module.exports = function(grunt){
//project configuration
grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    concat: {
        slides :  {
            src : ['src/top.html', 'src/bottom.html'],
            dest : ['build/index.html']
        }
    }
});

//enable plugins
grunt.loadNpmTasks('grunt-contrib');
grunt.registerTask('default', ['concat:slides']);
}
这将创建build/directory fine,但提供以下输出:

正在运行“concat:slides”(concat)任务警告:无法写入 “build/index.html”文件(错误代码:未定义)。用力 继续

我尝试在目录上运行chmod777,因为我认为它可能与权限有关,但这似乎没有改变任何事情

我怎样才能让Grunt将其写入build/index.html?

解决了这个问题:

//Does not work
dest : ['build/index.html']
用作字符串,但不是数组:

//Works
dest : 'build/index.html'

我将tasks/concat.js更改为接受dest的数组:

// Write the destination file.
// If f.dest is an array take the first element
var dest  = ([].concat(f.dest))[0]
grunt.file.write(dest, src);
但后来我决定使用文件表单而不是src/dest:

files: { 'dest.js': ['a.js', 'b.js'] }

我也有同样的问题,发现了一个类似的问题,并根据你的回答给出了答案。所有的功劳都归你了,非常感谢:)这个答案帮助我修复了另一个语法错误。确保使用“dest”而不是“dst”。我的是“desc”而不是“dest”。(: