I tried to install grunt on Ubuntu 14.04 and wrote grunt serve
I am getting this error.
Warning: Task "serve" not found. Use --force to continue.
Aborted due to warnings.
- I have Gruntfile.js in my project folder next to package.json file
When I write grunt --version I get:
grunt-cli v0.1.13 grunt v0.4.5
I have read Grunt documentation
All Installations done through sudo
- Tried this as well
This is the Gruntfile sample code I took from Official Grunt documentation.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['uglify']);
};
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
serve:{
options: {
port: 8000
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
},
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-serve');
// Default task(s).
grunt.registerTask('default', ['uglify']);
}