Gruntjs 咕噜-任务“;集合;找不到

Gruntjs 咕噜-任务“;集合;找不到,gruntjs,assemble,Gruntjs,Assemble,我已经玩了好几个小时了 package.json { "name": "compile-tests", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "devDep

我已经玩了好几个小时了

package.json

{
  "name": "compile-tests",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "grunt": "^0.4.5",
    "assemble": "^0.7.3"
  }
}
Grunfile.js

module.exports = function(grunt) {
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        assemble: {
            options: {
                flatten: true,
                layout: "../templates/1.hbs"
            },
            pages: {
                files: {
                    '../dist' : ['../pages/*.hbs']
                }
            }

        }
    });
    grunt.loadNpmTasks('assemble');
    grunt.registerTask('default', ['assemble']);
};
grunt.loadNpmTasks('grunt-assemble');
多次尝试卸下并重新安装所有模块。还尝试了不同的版本,有趣的是,本文中提到的版本似乎可以正常工作,但是我遇到了其他问题,因为这些版本已经过时了

错误


我只需要用grunt来组装

$ npm install grunt-assemble --save-dev
并在grunfile.js中调整此行

module.exports = function(grunt) {
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        assemble: {
            options: {
                flatten: true,
                layout: "../templates/1.hbs"
            },
            pages: {
                files: {
                    '../dist' : ['../pages/*.hbs']
                }
            }

        }
    });
    grunt.loadNpmTasks('assemble');
    grunt.registerTask('default', ['assemble']);
};
grunt.loadNpmTasks('grunt-assemble');

Assembly最近发生了变化,Grunt包装器不在版本0.7中,您必须返回到0.4.x或使用Grunt Assemble