我第一次尝试grunt.js并且有一些初学者问题。
我想连接/ foundation /文件夹中的所有js文件
我收到了这个错误:
Running "concat:options" (concat) task
TypeError: Cannot read property 'linefeed' of undefined
at Object.module.exports (....file path here...../_compass/javascripts/node_modules/grunt-contrib-concat/tasks/concat.js:19:28)
at Object.task.registerMultiTask.thisTask (/usr/local/lib/node_modules/grunt/lib/grunt/task.js:109:15)
at Object.task.registerTask.thisTask.fn (/usr/local/lib/node_modules/grunt/lib/grunt/task.js:58:16)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:343:36)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:319:9)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:346:11)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:319:9)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:346:11)
at Task.start (/usr/local/lib/node_modules/grunt/lib/util/task.js:359:5)
at Object.grunt.tasks (/usr/local/lib/node_modules/grunt/lib/grunt.js:143:8)
我的grunt文件看起来像这样
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Read in the project settings from the package.json file
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['foundation/*.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
});
// Load the plugin that provides the "concat" task.
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task(s).
grunt.registerTask('default', ['concat']);
};
任何帮助将不胜感激
答案 0 :(得分:2)
要解决此问题,我卸载了grunt,安装了最新版本候选版本,使用npm cache clean清除了缓存并安装了最新版本的concat模块候选版本。它现在正在运作。