我正在考虑 grunt 并尝试通过 grunt 和 connect 运行我的网站。我有一个像这样的 gruntfile:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
middleware: function (connect) {
return [
connect.static('.tmp'),
connect().use(
'/bower_components',
connect.static('./bower_components')
),
connect.static(appConfig.app)
];
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['connect:livereload','watch']);
};
问题是当我运行 grunt 时出现错误:
Running "connect:livereload" (connect) task
Warning: undefined is not a function Use --force to continue.
Aborted due to warnings.
我怎样才能咕噜咕噜地跑?